- 论坛徽章:
- 0
|
要求扫盲,刚才被别一个也刚毕业的鄙视了.郁闷
Tomcat 下有个工具${TOMCAT.HOME}/bin/jspc.sh
1. export JASPER_HOME=${TOMCAT.HOME}
2. export path=$path {TOMCAT.HOME}/bin
------[noCache.jsp]------------------
<%@ page contentType="text/html;charset=UTF-8" language="java" %>;
<%
response.setHeader("Cache-Control","no-cache" ; //HTTP 1.1
response.setHeader(" ragma","no-cache" ; //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>;
<%
out.println("Hello, how are you!" ;
%>;
运行命令jspc -d . nocache.jsp,会在当前目录下生成noCache_jsp.java
------[noCache_jsp.java]------------------
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.jsp.*;
- import org.apache.jasper.runtime.*;
- public class noCache_jsp extends HttpJspBase {
- private static java.util.Vector _jspx_includes;
- public java.util.List getIncludes() {
- return _jspx_includes;
- }
- public void _jspService(HttpServletRequest request, HttpServletResponse response)
- throws java.io.IOException, ServletException {
- JspFactory _jspxFactory = null;
- javax.servlet.jsp.PageContext pageContext = null;
- HttpSession session = null;
- ServletContext application = null;
- ServletConfig config = null;
- JspWriter out = null;
- Object page = this;
- JspWriter _jspx_out = null;
- try {
- _jspxFactory = JspFactory.getDefaultFactory();
- response.setContentType("text/html;charset=UTF-8");
- pageContext = _jspxFactory.getPageContext(this, request, response,
- null, true, 8192, true);
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- _jspx_out = out;
- out.write("\r\n");
- response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
- response.setHeader("Pragma","no-cache"); //HTTP 1.0
- response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
- out.write("\r\n");
- out.println("Hello, how are you!");
- out.write("\r\n");
- } catch (Throwable t) {
- out = _jspx_out;
- if (out != null && out.getBufferSize() != 0)
- out.clearBuffer();
- if (pageContext != null) pageContext.handlePageException(t);
- } finally {
- if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
- }
- }
- }
复制代码
明白了么?jsp根本就是一个脚本语言,最后还是要生成servlet.. |
|