Jsp browser access information, operating system information, Client IP address, jspip
<% String path = request. getContextPath (); String agent = request. getHeader ("User-Agent"); String browInfo [] = agent. split (";"); String realBrowser = browInfo [1]. trim (); // browser information String osInfo = System. getProperty ("OS. name "); // operating system information String ip = request. getRemoteAddr (); // Client IP address %>
How to obtain the browser and operating system information of the client in jsp
// Obtain the user's browser name String userbrowser = st. nextToken (); // obtain the user's operating system name String useros = st. nextToken (); obtain the information of the local machine as follows: Operating System Information System. getProperty ("OS. version "); System. getProperty ("OS. arch "); Browser: request. getHeader ("User-Agent") then sends a red packet request. getHeader (User-agent) returns the version number and type of the client browser getHeader (String name): Get the transfer file header information defined by the http protocol, request. getMethod (): The methods used to obtain data transmitted from the client to the server include GET, POST, PUT, and other types of requests. getRequestURI (): Get the client address request that sends the request string. getServletPath (): Get the file path request of the script file requested by the client. getServerName (): Get the server name request. getServerPort (): Get the server port number request. getRemoteAddr (): Get the Client IP address request. getRemoteHost (): get the name of the client computer. If the source code fails, the system returns the IP address request of the client computer. getProtocol (): request. getHeaderNames (): returns the names of all request headers. The result set is an instance request of the Enumeration (Enumeration) class. getHeaders (String name): returns all values of the request header with the specified name. The result set is an instance of the Enumeration (Enumeration) class.
How to obtain the browser and operating system information of the client in jsp
// 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. version ");
System. getProperty ("OS. arch "); Response handler: request. getHeader ("User-Agent") then sends a red packet request. getHeader (User-agent) returns the client browser version number and type
GetHeader (String name): Get the header information defined by the http protocol,
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 (): Obtain the name of the client computer.
Returns the IP address of the client.
Request. getProtocol ():
Request. getHeaderNames (): returns the names of all request headers. The result set is an instance of the Enumeration (Enumeration) class.
Request. getHeaders (String name): returns all the values of the request header with the specified name. The result set is an instance of the Enumeration (Enumeration) class.