Request
获取数据
calss request |
meaning |
getParameter("name") |
获取1个name参数对应的值 |
getAllParameter("name") |
获取所有name对应的值,返回[]String |
Enumeration getParameterNames() |
|
Object getAttribute(String key) |
返回Map映射中key对应的值 |
void setAttribute(String key,Object value) |
|
Enumeration getAttributeNames() |
|
获取客户及服务器的机器信息
方法 |
meaning |
String getRemoteAddr |
获取客户端的IP地址 |
String getRemoteHost |
|
String getRemoteUser |
|
String getLocalName |
|
String getLocalAddr |
|
String getLocalPort |
|
response
method |
meaning |
void setHeader(String key,String value) |
|
vlid addHeader(String key,String value) |
|
Collection getHeaderNames() |
|
String getHeader(String key) |
|
Collection getHeaders(String key) |
|
void setContentType(String type) |
|
Shared var object
application session request
Session |
meaning |
getId() |
return session ID |
boolean isNew() |
return is a new session |
setAttribute(Stirng key,String object) |
put key-value in session |
ObjectgetAttribute(String name) |
|
Enumeration getAttributeNames() |
|
long getCreationTime() |
|
long getLastAccessTime |
|
setMaxInactive Interval |
set session max-time |
set invalidate() |
clear the session |
application |
|
String getInitParameter(String name) |
for read web.xml |
void log(String msg) |
|
void log(Stirng msg,Throwable th) |
print msg in log file |