📄 eventhandlerbase.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 + -