📄 controller.jsp
字号:
<%@page import="java.util.*"%>
<%@page import="java.io.*"%>
<%@page import="org.w3c.dom.Document"%>
<%@page import="mvc.*"%>
<%
/*
The MVC framework shown for this chapter use the Xalan XSLT
processor and Xerces XML parser. Xalan and Xerces are freely
available from the http://xml.apache.org. The MVC framework built
in this chapter uses version 2.2.D6 of the Xalan XSLT processor and
version 1.3 of the Xerces XML parser. In controller.jsp the
org.w3c.dom.Document class comes from the Xerces jar file
(xerces.jar).
*/
/*
The controller JSP is the controller piece of the MVC Framework.
This piece will first try and retrieve the name of the XSL file the
user wants to view. After the xslFileName is retrieved it will
instantiate the Request handler. The request handler will invoke the
appropriate model. The model will return an XML document with all of
the data to be presented to the end-user. The controller.jsp will
then return the JspWriter out variable, the data returned from the
RequestHandler, and the name of the XSL file that will be used to
present the data. The XSLTManager will carry out the merging of the
XSL and XML document.
*/
try{
String requestValue = request.getParameter("Request");
String actionValue = request.getParameter("Action");
/*Step 1 - Retrieve the name of the XSL file that is going to be used*/
String xslFileName =
MVCHelper.getXSLFileName(requestValue,actionValue);
if (xslFileName == null){
throw new Exception("Unable to locate an XSL file that matches the " +
"request and action requested. Request: " +
requestValue + " , Action: " + actionValue);
}
/*Step 2 - Instantiate the RequestHandler and process the user's request
*/
RequestHandler requestHandler = new RequestHandler();
Document returnedData = requestHandler.process(request);
/*Step 3 - Take the Document retrieved from the requesthandler and
transform it to HTML
*/
XSLTManager xsltManager = new XSLTManager();
xsltManager.transformOutput(out, returnedData, xslFileName);
} catch(Exception e){
MVCHelper.buildErrorPage(e, out);
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -