The Source for Java Technology Collaboration
User: Password:



Jayson Falkner

Jayson Falkner's Blog

Blarg #25: A JSP that shows Request Headers

Posted by jfalkner on July 03, 2006 at 06:32 PM | Comments (1)

This code as been shown many times before, including in my book. This is exactly what the title says: a JSP that will display the request headers sent by your browser. It is also a good example of how to use the JSP EL and the JSTL core tags to make an incredibly simple JSP.

Here is the code. Simply copy and paste it in to a JSP, ideally one that you are editing in Netbeans. You must have the JSTL JARs in your classpath.

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head><title>HTTP Request Headers</title></head>
<body>
<h2>This is a list of the HTTP request headers sent by your browser.</h2>

<c:forEach var="v" items="${header}">
    <b>${v.key}</b>: ${v.value}<br />
</c:forEach>

</body>
</html>

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Excuse me.I have not related question.
    I try to run this code in my app server.
    but there was an error.I put c:out before key and value and problem was solved.
    I didn't saw this syntax for jstl.How can I run this code?

    Posted by: hmmahboobi on July 05, 2006 at 11:14 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds