这个压缩包里的都是超级经典的java例子
源代码在线查看: gethead.htm
Getting a Request Header in a JSP Page (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
javax.servlet.jsp
[18 examples]
>
Java Server Pages Headers
[3 examples]
e1061. Getting a Request Header in a JSP Page
A JSP page can access the information in the request header by using
the implicit object request.
This example retrieves a few items in the request header:
The request method is <%= request.getMethod() %>
The request URI is <%= request.getRequestURI() %>
The request protocol is <%= request.getProtocol() %>
The browser is <%= request.getHeader("user-agent") %>
This example retrieves all the items in the request header:
<%
java.util.Enumeration names = request.getHeaderNames();
while (names.hasMoreElements()) {
String name = (String)names.nextElement();
out.println(name+": "+request.getHeader(name));
}
%>
See also eX X.
Related Examples
e1062.
Implementing a Redirect in a JSP Page
e1063.
Generating an XML Document from a JSP Page
See also:
Java Server Pages
Java Server Pages Input
Java Server Pages Output
© 2002 Addison-Wesley.