分类: Java
2008-05-21 15:13:48
ASP |
JSP |
Request |
Request |
QueryString |
Request.getParameter(“name”) |
.Item | |
.count |
Request.getParameterMap().size() |
.key |
request.getParameterNames(),会得到一个 |
Form |
|
.count |
Request.getParameterMap().size() |
.Item |
Request.getParameter(“name”) |
.key |
同QueryString的key |
ServerVariable | |
方法 |
|
BinaryRead(byteCount) |
request.getReader().read(char[] cbuf,off,len) |
变量 |
request.getHeader(java.lang.String name) |
ALL_HTTP | |
APPL_PHYSICAL_PATH |
request.getContextPath() |
AUTH_TYPE |
request.getAuthType() |
CONTENT_TYPE |
request.getContentType() |
CONTENT_LENGTH |
request.getContentLength() |
PATH_INFO |
request.getPathInfo() |
PATH_TRANSLATED |
request.getPathTranslated() |
QUERY_STRING |
request.getQueryString() |
REMOTE_ADDR |
request.getRemoteAddr() |
REMOTE_HOST |
request.getRemoteHost() |
REMOTE_USER |
request.getRemoteUser() |
REQUEST_METHOD |
request.getMethod() |
SCRIPT_NAME |
request.getServletPath() |
SERVER_NAME |
request.getServerName() |
SERVER_PORT |
request.getServerPort() |
SERVER_PROTOCOL |
request.getProtocol() |
SERVER_SOFTWARE |
Application.getServerInfo() |
URL |
request.getRequestURL() |
Response | |
方法 |
|
Write(String) |
Out.print(String) |
BinaryWrite(byteArray) |
|
Redirect(URL String) |
response.sendRedirect() |
AddHeader(“header name”,”value”) |
response.addHeader(String name,String value) |
AppendToLog(String) |
response.application.log() |
Flush() |
Out.flush()或者response. |
Clear() |
Oue.clear()或者response.resetBuffer() |
End() |
Out.close()+return |
属性 |
|
Charset=“char-type”(iso8859_1) |
response.setContentType(“charset= iso8859_1”) |
ContentType=[“text/html”/”text/plain”/ ”image/GIF”/”image/JPEG”] |
response.setContentType([“text/html”/”text/plain”/ ”image/GIF”/”image/JPEG”]) |
Application | |
存储变量application(“variable”)=value |
Application.setAttribute(“name”,”value”) |
Content集合 |
Application.getAttribute(“name”) |
.item |
Application.getAttribute(“name”) |
.key |
同request.QueryString的key |
.count |
application.getAttributeNames(),会得到一个 |
方法 |
|
Remove(“property name”) |
Application.removeAttribute(“name”) |
RemoveAll() |
application.getAttributeNames()会得到一个 |
StaticObject集合(存储自定义对象) |
Application.setAttribute(“name”,”value”) |
Session | |
事件 |
|
Session_OnStart() |
可以做一个针对HttpSession对象的监听器,在一个session对象生成的时候调用他的sessionCreated()方法,在会话结束时调用sessionDestory()方法。具体实现见《Global.asa文件的替换》一节 |
Session_OnEnd() | |
方法 |
|
存储变量:session(“variable”)=value |
Session.setAttribute(“name”,”value”) |
Abandon() |
|
Content集合 |
同application对象 |
.item | |
.key | |
.count | |
方法 | |
Remove(“property name”) | |
RemoveAll() | |
属性 |
|
LCID 地区标识符 |
Response.setLocales()设置区域属性 Request.getLocals()取得区域属性 |
SessionID 会话标识符 |
session.getID() |
Timeout 超时时间 |
Session.getMaxInactiveInterval() Session.setMaxInactiveInterval() |
Server | |
方法 |
|
CreateObject() |
用于建立ActiveX对象,在JSP中用不到 |
Execute(“url”) |
|
Transfer() |
|
HTMLEncode() |
JSP中没有这个方法,需要自己编写代码 |
URLEnode() |
response.encodeURL() |
MapPath() URL转为物理路径 |
|