📄 ex6_16.txt
字号:
Example 6.16 Command and Controller Strategy
/** This processRequest method is invoked from both
* the servlet doGet and doPost methods **/
protected void processRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
java.io.IOException {
String resultPage;
try {
RequestHelper helper = new RequestHelper(request);
/** the getCommand() method internally uses a
* factory to retrieve command objects as follows:
* Command command = CommandFactory.create(
* request.getParameter(op));
**/
Command command = helper.getCommand();
// delegate request to a command object helper
resultPage = command.execute(request, response);
} catch (Exception e) {
LogManager.logMessage("FrontController", e.getMessage());
resultPage = ApplicationResources.getInstance().getErrorPage(e);
}
dispatch(request, response, resultPage);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -