Blarg #25: A JSP that shows Request Headers
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>
- Login or register to post comments
- Printer-friendly version
- jfalkner's blog
- 1517 reads





