标签:
请求-->调用Servlet-->响应JSP-->翻译JSP成_JSPServlet-->生成静态HTML代码-->浏览器解析生成页面
|
1 /* 2 * Generated by the Jasper component of Apache Tomcat 3 * Version: Apache Tomcat/7.0.63 4 * Generated at: 2016-05-18 02:24:09 UTC 5 * Note: The last modified time of this file was set to 6 * the last modified time of the source file after 7 * generation to assist with modification tracking. 8 */ 9 package org.apache.jsp.WEB_002dINF.jsp; 10 11 import javax.servlet.*; 12 import javax.servlet.http.*; 13 import javax.servlet.jsp.*; 14 15 public final class userList_jsp extends org.apache.jasper.runtime.HttpJspBase 16 implements org.apache.jasper.runtime.JspSourceDependent { 17 18 19 20 21 private static final javax.servlet.jsp.JspFactory _jspxFactory = 22 javax.servlet.jsp.JspFactory.getDefaultFactory(); 23 24 private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; 25 26 private javax.el.ExpressionFactory _el_expressionfactory; 27 private org.apache.tomcat.InstanceManager _jsp_instancemanager; 28 29 public java.util.Map<java.lang.String,java.lang.Long> getDependants() { 30 return _jspx_dependants; 31 } 32 33 public void _jspInit() { 34 _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); 35 _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); 36 } 37 38 public void _jspDestroy() { 39 } 40 41 public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) 42 throws java.io.IOException, javax.servlet.ServletException { 43 44 final javax.servlet.jsp.PageContext pageContext; 45 javax.servlet.http.HttpSession session = null; 46 final javax.servlet.ServletContext application; 47 final javax.servlet.ServletConfig config; 48 javax.servlet.jsp.JspWriter out = null; 49 final java.lang.Object page = this; 50 javax.servlet.jsp.JspWriter _jspx_out = null; 51 javax.servlet.jsp.PageContext _jspx_page_context = null; 52 53 54 try { 55 response.setContentType("text/html; charset=utf-8"); 56 pageContext = _jspxFactory.getPageContext(this, request, response, 57 null, true, 8192, true); 58 _jspx_page_context = pageContext; 59 application = pageContext.getServletContext(); 60 config = pageContext.getServletConfig(); 61 session = pageContext.getSession(); 62 out = pageContext.getOut(); 63 _jspx_out = out; 64 65 out.write("\r\n"); 66 out.write("\r\n"); 67 out.write("\r\n"); 68 69 String path = request.getContextPath(); 70 String basePath = request.getScheme() + "://" 71 + request.getServerName() + ":" + request.getServerPort() 72 + path + "/"; 73 pageContext.getAttributesScope("aa"); 74 out.print(pageContext.getAttributesScope("aa")); 75 76 out.write("\r\n"); 77 out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); 78 out.write("<html>\r\n"); 79 out.write("<head>\r\n"); 80 out.write("<base href=\""); 81 out.print(basePath); 82 out.write("\">\r\n"); 83 out.write("<meta charset=\"UTF-8\">\r\n"); 84 out.write("<title>权限管理</title>\r\n"); 85 out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"css/user.manager.css\">\r\n"); 86 out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/ui.jqgrid.css\">\r\n"); 87 out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/redmond/jquery-ui-1.7.1.custom.css\">\r\n"); 88 out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"themes/ui.jqgrid.css\">\r\n"); 89 out.write("<script type=\"text/javascript\" src=\"js/jquery-1.8.2.min.js\"></script>\r\n"); 90 out.write("\r\n"); 91 out.write("\r\n"); 92 out.write("</head>\r\n"); 93 out.write("<body>\r\n"); 94 out.write("<div class=\"ston_container\">\r\n"); 95 out.write("\t<form action=\"\" class=\"ston_form_box\" method=\"post\">\r\n"); 96 out.write("\t\t<h1>用户权限管理</h1>\r\n"); 97 out.write("\t\t<div class=\"ston_serch\">\r\n"); 98 out.write("\t\t\t<input type=\"text\" name=\"userName\" id=\"userName\" placeholder=\"请输入用户名\">\r\n"); 99 out.write("\t\t\t<div class=\"ston_search ston_button\" data-value=\"search\"><a href=\"javascript:void(0)\" onclick=\"gridReload()\"><img src=\"images/search.png\" width=\"100%\" /></a></div>\r\n"); 100 out.write("\t\t</div>\r\n"); 101 out.write("\t\t"); 102 out.write("\r\n"); 103 out.write("\t\t<div class=\"jqGrid_wrapper\">\r\n"); 104 out.write(" \t<table id=\"jqGrid\"></table>\r\n"); 105 out.write(" <div id=\"pager\"></div>\r\n"); 106 out.write(" </div>\r\n"); 107 out.write("\t</form>\r\n"); 108 out.write("</div>\r\n"); 109 out.write("\r\n"); 110 out.write("<div class=\"ston_hidbox ston_userList\">\r\n"); 111 out.write("\t<div class=\"ston_close\">\r\n"); 112 out.write("\t\t<a href=\"javascript:void(0)\"><img src=\"images/tanc_03.png\" width=\"100%\" /></a>\r\n"); 113 out.write("\t</div>\r\n"); 114 out.write("\t<h3 class=\"ston_box_title\">权限编辑</h3>\r\n"); 115 out.write("\t<div class=\"ston_manbox\">\r\n"); 116 out.write("\t\t<form id=\"manageControl\" action=\"\" method=\"get\">\r\n"); 117 out.write("\t\t\t<div class=\"manageControl_list\">\r\n"); 118 out.write("\t\t\t</div>\r\n"); 119 out.write("\t\t\t\r\n"); 120 out.write("\t</form>\r\n"); 121 out.write("\t</div>\r\n"); 122 out.write("\t<div class=\"ston_btn_box\">\r\n"); 123 out.write("\t\t<a href=\"javascript:void(0)\" class=\"ston_btn ston_alter\">确定</a>\r\n"); 124 out.write("\t\t<a href=\"javascript:void(0)\" class=\"ston_btn ston_cancel\">取消</a>\r\n"); 125 out.write("\t</div>\r\n"); 126 out.write("\r\n"); 127 out.write("</div>\r\n"); 128 out.write("\r\n"); 129 out.write("\r\n"); 130 out.write("<script type=\"text/javascript\" src=\"js/i18n/grid.locale-bg.js\"></script>\r\n"); 131 out.write("<script type=\"text/javascript\" src=\"js/i18n/grid.locale-en.js\"></script>\r\n"); 132 out.write("<script type=\"text/javascript\" src=\"js/jquery-ui-1.7.1.custom.min.js\"></script>\r\n"); 133 out.write("<script type=\"text/javascript\" src=\"js/jquery.jqGrid.min.js\"></script>\r\n"); 134 out.write("<script type=\"text/javascript\" src=\"js/jquery.jqGrid.src.js\"></script>\r\n"); 135 out.write("<script type=\"text/javascript\" src=\"js/user.manager.js\"></script>\r\n"); 136 out.write("\r\n"); 137 out.write("<script type=\"text/javascript\">\r\n"); 138 out.write("var base = ‘"); 139 out.print(path); 140 out.write("‘;\r\n"); 141 out.write("</script>\r\n"); 142 out.write("</body>\r\n"); 143 out.write("</html>"); 144 } catch (java.lang.Throwable t) { 145 if (!(t instanceof javax.servlet.jsp.SkipPageException)){ 146 out = _jspx_out; 147 if (out != null && out.getBufferSize() != 0) 148 try { 149 if (response.isCommitted()) { 150 out.flush(); 151 } else { 152 out.clearBuffer(); 153 } 154 } catch (java.io.IOException e) {} 155 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); 156 else throw new ServletException(t); 157 } 158 } finally { 159 _jspxFactory.releasePageContext(_jspx_page_context); 160 } 161 } 162 }
final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this;
名称 |
说明
|
所属类型
|
属性范围
|
request
|
请求对象
|
javax.servlet.http.HttpServletRequest
|
request
|
response
|
响应对象
|
javax.servlet.http.HttpServletResponse
|
page
|
page
|
页面对象
|
javax.lang.Object
|
page
|
pageContext |
页面上下文对象
|
javax.servlet.jsp.PageContext
|
Page
|
session
|
会话对象 |
javax.servlet.http.HttpSession
|
session
|
application
|
应用程序对象
|
javax.servlet.ServletContext
|
application
|
config
|
配置对象
|
javax.servlet.ServletConfig
|
Page
|
out
|
输出对象
|
javax.servlet.jsp.JspWriter
|
Page
|
exception
|
例外对象
|
javax.lang.Throwable
|
Page
|
客户端的请求信息被封装在request对象中,主要包括包括头信息、系统信息、请求方式以及请求参数等,然后做出响应。它是HttpServletRequest类的实例。
1
|
object getAttribute(String name)
|
返回指定属性的属性值
|
2
|
Enumeration getAttributeNames()
|
返回所有可用属性名的枚举
|
3
|
String getCharacterEncoding()
|
返回字符编码方式
|
4
|
int getContentLength()
|
返回请求体的长度(以字节数)
|
5
|
String getContentType()
|
得到请求体的MIME类型
|
6
|
ServletInputStream getInputStream()
|
得到请求体中一行的二进制流
|
7
|
String getParameter(String name)
|
返回name指定参数的参数值
|
8
|
Enumeration getParameterNames()
|
返回可用参数名的枚举
|
9
|
String[] getParameterValues(String name)
|
返回包含参数name的所有值的数组
|
10
|
String getProtocol()
|
返回请求用的协议类型及版本号
|
11
|
String getScheme()
|
返回请求用的计划名,如:http.https及ftp等
|
12
|
String getServerName()
|
返回接受请求的服务器主机名
|
13
|
int getServerPort()
|
返回服务器接受此请求所用的端口号
|
14
|
BufferedReader getReader()
|
返回解码过了的请求体
|
15
|
String getRemoteAddr()
|
返回发送此请求的客户端IP地址
|
16
|
String getRemoteHost()
|
返回发送此请求的客户端主机名
|
17
|
void setAttribute(String key,Object obj)
|
设置属性的属性值
|
18
|
String getRealPath(String path)
|
返回一虚拟路径的真实路径
|
1
|
String getCharacterEncoding()
|
返回响应用的是何种字符编码
|
2
|
ServletOutputStream getOutputStream()
|
返回响应的一个二进制输出流
|
3
|
PrintWriter getWriter()
|
返回可以向客户端输出字符的一个对象
|
4
|
void setContentLength(int len)
|
设置响应头长度
|
5
|
void setContentType(String type)
|
设置响应的MIME类型
|
6
|
sendRedirect(java.lang.String location)
|
重新定向客户端的请求
|
1
|
long getCreationTime()
|
返回SESSION创建时间
|
2
|
public String getId()
|
返回SESSION创建时JSP引擎为它设的惟一ID号
|
3
|
long getLastAccessedTime()
|
返回此SESSION里客户端最近一次请求时间
|
4
|
int getMaxInactiveInterval()
|
返回两次请求间隔多长时间此SESSION被取消(ms)
|
5
|
String[] getValueNames()
|
返回一个包含此SESSION中所有可用属性的数组
|
6
|
void invalidate()
|
取消SESSION,使SESSION不可用
|
7
|
boolean isNew()
|
返回服务器创建的一个SESSION,客户端是否已经加入
|
8
|
void removeValue(String name)
|
删除SESSION中指定的属性
|
9
|
void setMaxInactiveInterval()
|
设置两次请求间隔多长时间此SESSION被取消(ms)
|
final java.lang.Object page = this;
response.setContentType("text/html; charset=utf-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out;
1
|
getException
|
返回exception隐式对象
|
2
|
getPage
|
返回page隐式对象
|
3
|
getRequest
|
返回request隐式对象
|
4
|
getResponse
|
返回response隐式对象
|
5
|
getServletConfig
|
返回config隐式对象
|
6
|
getServletContext
|
返回application隐式对象
|
7
|
getSession
|
返回session隐式对象
|
8
|
getOut
|
返回out隐式对象
|
9
|
public void setAttribute(String name,Object value)
public void setAttribute(String name,Object value,int scope)
|
设置属性的属性值
|
10
|
public java.lang.Object getAttribute(String name)
|
获取属性的属性值
|
11
|
public void removeAttribute(String name)
|
移除属性的属性值
|
12
|
public java.lang.Object findAttribute(String name)
|
查找属性的属性值
|
13
|
release()
|
该方法将会释放pageContext对象所占的资源
|
public static final int PAGE_SCOPE = 1; /** * Request scope: the named reference remains available from the * ServletRequest associated with the Servlet until the current request * is completed. */ public static final int REQUEST_SCOPE = 2; /** * Session scope (only valid if this page participates in a session): * the named reference remains available from the HttpSession (if any) * associated with the Servlet until the HttpSession is invalidated. */ public static final int SESSION_SCOPE = 3; /** * Application scope: named reference remains available in the * ServletContext until it is reclaimed. */ public static final int APPLICATION_SCOPE = 4;
6.application对象:
application对象可以将信息保存在服务器中,直至服务器关闭,在整个应用过程都有效,类似系统全局变量。如我们在web.xml中配置Spring 的配置文件参数信息可以通过application来获取
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:spring/*.xml</param-value> </context-param>
application.getInitParameter("contextConfigLocation")
也可直接将属性值放至其中,以达到整个web应用共享该变量信息。常用方法如下:
1
|
Object getAttribute(String name) |
返回给定名的属性值 |
2
|
Enumeration getAttributeNames()
|
返回所有可用属性名的枚举
|
3
|
void setAttribute(String name,Object obj) |
设定属性的属性值 |
4
|
void removeAttribute(String name)
|
删除一属性及其属性值
|
5
|
String getServerInfo()
|
返回JSP(SERVLET)引擎名及版本号
|
6
|
String getRealPath(String path)
|
返回一虚拟路径的真实路径
|
7
|
ServletContext getContext(String uripath)
|
返回指定WebApplication的application对象
|
8
|
int getMajorVersion()
|
返回服务器支持的Servlet API的最大版本号
|
9
|
int getMinorVersion()
|
返回服务器支持的Servlet API的最大版本号
|
10
|
String getMimeType(String file)
|
返回指定文件的MIME类型
|
11
|
URL getResource(String path)
|
返回指定资源(文件及目录)的URL路径
|
12
|
InputStream getResourceAsStream(String path)
|
返回指定资源的输入流
|
13
|
RequestDispatcher getRequestDispatcher(String uripath)
|
返回指定资源的RequestDispatcher对象
|
14
|
Servlet getServlet(String name)
|
返回指定名的Servlet
|
15
|
void log(String msg)
|
把指定消息写入Servlet的日志文件
|
16
|
void log(Exception exception,String msg)
|
把指定异常的栈轨迹及错误消息写入Servlet的日志文件
|
17
|
Enumeration getServlets()
|
返回所有Servlet的枚举
|
18
|
Enumeration getServletNames()
|
返回所有Servlet名的枚举
|
1
|
void clear()
|
清除缓冲区的内容
|
2
|
void clearBuffer()
|
清除缓冲区的当前内容
|
3
|
void flush()
|
清空流
|
4
|
int getBufferSize()
|
返回缓冲区以字节数的大小,如不设缓冲区则为0
|
5
|
int getRemaining()
|
返回缓冲区还剩余多少可用
|
6
|
boolean isAutoFlush()
|
返回缓冲区满时,是自动清空还是抛出异常
|
7
|
void close()
|
关闭输出流
|
1.都是继承自 Java.io.Writer ,JspPriter对象由JspWriter可以在JSP页面中直接用out对象输出.可以用pageContext.getOut();
2.执行原理不同:JspWriter相当于一个带缓存功能的printWriter,它不是直接将数据输出到页面,而是将数据刷新到response的缓冲
<servlet> <servlet-name>admin</servlet-name> <jsp-file>/TestConfig01.jsp</jsp-file> <init-param> <param-name>email</param-name> <param-value>service@abc.com</param-value> </init-param> <init-param> <param-name>phone</param-name> <param-value>0411-12345678</param-value> </init-param> <init-param> <param-name>qq</param-name> <param-value>88888</param-value> </init-param> </servlet>
1
|
String getInitParameter(String name)
|
根据指定的初始化参数名称,获取对应的参数值
|
2
|
Enumeration getInitParameterNames()
|
获取所有的初始化参数名称
|
3
|
ServletContext getServletContext()
|
返回一个ServletContext接口的对象
|
4
|
String getServletName()
|
获取当前Servlet对象的名称。
|
exception对象是一个例外对象,当一个页面在运行过程中发生了例外,就产生这个对象。如果一个JSP页面要应用此对象,就必须把isErrorPage设为true,否则无法编译。他实际上是java.lang.Throwable的对象。
1
|
String getMessage()
|
返回描述异常的消息
|
2
|
String toString()
|
返回关于异常的简短描述消息
|
3
|
void printStackTrace()
|
显示异常及其栈轨迹
|
4
|
Throwable FillInStackTrace()
|
重写异常的执行栈轨迹
|
标签:
原文地址:http://www.cnblogs.com/ant-world/p/5505591.html