⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventhandlerbase.java

📁 MVC结构开发简单例子 非常实用的..有学习MVC的可以看看.
💻 JAVA
字号:
package com.mvc.event.baseEvent;import java.io.IOException;import javax.servlet.RequestDispatcher;import javax.servlet.ServletContext;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public abstract class EventHandlerBase {  protected abstract String getURL();  public void process( HttpServletRequest request, HttpServletResponse response )    throws IOException,           ServletException{  }  public void forward( HttpServletRequest request, HttpServletResponse response )    throws IOException,           ServletException{    try{      _dispatch( request, response );    }catch( IOException i ){      throw i;    }catch( ServletException s ){      throw s;    }  }  protected void _dispatch( HttpServletRequest request, HttpServletResponse response )    throws IOException,           ServletException{    RequestDispatcher rd = request.getRequestDispatcher( getURL() );    if( rd == null ){      throw new ServletException("resource RequestDispatcher apply failed");    }    rd.forward( request, response );  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -