📄 frontcontroller.java
字号:
package controler;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
public class FrontController extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
protected void processRequest(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String actionName = req.getPathInfo().substring(1);
System.out.println(actionName);
Action action = ActionHelper.getAction(actionName);
String nextView = action.process(req, res);
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(nextView);
dispatcher.forward(req,res);
}
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
processRequest(req, res);
}
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
processRequest(req, res);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -