Listato 2. Restituisce una risposta diversa in base al browser
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Request Analyzer</title>
</head>
<body>
<h1>Analisi delle Request header:</h1>
<table cellpadding="5" border="1">
<tr>
<td align="center"><b>Nome</b></td>
<td align="center"><b>Valore</b></td>
</tr>
<%@page import="java.util.*" %>
<%
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements())
{
String nome = (String) headerNames.nextElement();
String valore = request.getHeader(nome);
%>
<tr>
<td align="right"><%= nome %></td>
<td><%= valore %></td>
</tr>
<%
}
%>
</table>
</body>
</html>