My JSP mini Probe

Source: Internet
Author: User

It's okay to write a small probe to play, because it can only be embedded in the blog and so on, so this is just to get the user information, and I will write a powerful probe later.

The Code is as follows:

<% @ Page contenttype = "text/html; charset = gb2312" %>
<% @ Page import = "Java. util. *" %>
<Style type = text/CSS>
. Fontsize
{
Font-size: 9pt
}
</Style>
<Table width = "185" border = "1" align = "center" cellpadding = "0" cellspacing = "0" bordercolor = "# cccccc" class = "fontsize">
<Tr>
<TD colspan = "2"> <Div align = "center"> self-developed JSP probe mini edition: </div> </TD>
</Tr>
<Tr>
<TD width = "95"> HTTP Protocol Version: </TD>
<TD width = "84"> <% = request. getprotocol () %> </TD>
</Tr>
<%
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 ();
Useros = useros. substring (0, useros. Length ());
// Determine whether the user supports gzip compression transmission
String gzip = request. getheader ("Accept-encoding ");
If (gzip. indexof ("gzip") <0)
{
Gzip = "not supported ";
}
Else
{
Gzip = "supported ";
}
%>
<Tr>
<TD> your operating system: </TD>
<TD> <% = useros %> </TD>
</Tr>
<Tr>
<TD> your browser: </TD>
<TD> <% = userbrowser %> </TD>
</Tr>
<Tr>
<TD> whether your machine supports gzip compression transmission: </TD>
<TD> <% = gzip %> </TD>
</Tr>
<Tr>
<TD> your IP address: </TD>
<TD> <% = request. getremoteaddr () %> </TD>
</Tr>
</Table>

Put it in a space supporting JSP and write it on the interface to be referenced:

<IFRAME src = "http://XXX.XX.jsp" width = "220" Height = "200" frameborder = "0" scrolling = "no">
</Iframe>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.