String Agent = request. getHeader ("User-Agent "); StringTokenizer st = new StringTokenizer (Agent ,";"); St. nextToken (); // Obtain the user's browser name String userbrowser = st. nextToken (); // Obtain the user's OS name String useros = st. nextToken (); |
You can also obtain the information of the local machine as follows:
Operating System Information
System. getProperty ("OS. name"); // win2003 is actually win XP? System. getProperty ("OS. version "); System. getProperty ("OS. arch "); |
Browser
request.getHeader("User-Agent") |
Send another red packet:
Request. getHeader ("User-agent") returns the version and type of the client browser. GetHeader (String name): Get the Transfer File Header defined by http Request. getMethod (): The methods used to obtain data transmitted from the client to the server include GET, POST, PUT, and so on. Request. getRequestURI (): obtains the client address of the request string. Request. getServletPath (): Obtain the path of the script file requested by the client. Request. getServerName (): Get the server name Request. getServerPort (): Get the server port number Request. getRemoteAddr (): Obtain the Client IP Address Request. getRemoteHost (): obtains the name of the client computer. If the name fails, the IP address of the client computer is returned. Request. getProtocol (): Request. getHeaderNames (): returns the names of all request headers, The result set is an Enumeration) instance of the class. Request. getHeaders (String name): returns all request header values with the specified name, The result set is an Enumeration) instance of the class.
|
Related Articles]
- Rapid development of JSP applications using JSTL
- Three methods to display Chinese Characters in Web programs developed by JSP
- Session-based online user statistical analysis in JSP