This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13029|Reply: 0

[JavaEE] JSP has a common method of building object requests

[Copy link]
Posted on 12/11/2014 9:32:33 PM | | |
Method description
void setAttribute(String name, Object value) Stores the name attribute to the request object
Object getAttribute(String name) returns the value of the name attribute
void removeAttribute(String name) Removes the name attribute from the request object
String getParameter(String name) returns the parameter value of the specified name
Enumeration getParameterNames( ) returns all parameter names in an enum type
String[] getParameterValues(String name) returns all specified name parameter values by character array type
Map getParameterMap( ) returns the request parameter in type java.util.Map
String getProtocol( ) returns the protocol version used (e.g. HTTP/1.1)
String getRemoteAddr( ) returns the user's IP address
String getRemoteHost( ) returns the user's host name
int getRemotePort( ) returns the user's host port
void setCharacterEncoding(String code) Set the encoding method of the request body String getContextPath( ) Return the request context path (i.e., /site name)
String getMethod( ) returns http method (get, post, put, etc.)
String getQueryString( ) returns the query string contained after the request URI
String getRequestedSessionId( ) returns the session ID of the client
String getRequestURI( ) returns the request URI, excluding the requested query string
String getRequestURL( ) returns the full URL of the request, including the protocol, server name and port, and the URI of the request, but not the query string of the request
String getRemoteUser( ) returns the name of the logged-in user
String getHeader(String name) returns the title header of the specified name
Enumeration getHeaderNames() returns all header names in an enumeration type
Enumeration getHeaders(String name) returns all header headers of the specified name in an enum type
int getIntHeader(String name) returns the title header of the specified name as an integer type
long getDateHeader(String name) returns the title header of the specified name with the date type
Cookies [] getCookies( ) returns all cookies related to the request in a cookie array type








Previous:[Practice] jsp page URL question mark transmission of Chinese garbled characters
Next:JSP has built-in object response common methods
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com