O'Reilly logo

Jakarta Struts Cookbook by Bill Siggelkow

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.5. Troubleshooting JSP Pages

Problem

You want to see a dump of the names and values of servlet request and HTTP session attributes and for a particular JSP page so you can troubleshoot rendering problems.

Solution

Include the debug.jsp file shown on the JSP page (see Example 13-5).

Example 13-5. JSP dump of request, session, and context data

<hr width="3px"> Debug Information:<br> <table border="1" width="50%" class="debug"> <tr> <th colspan="3" style="background:orange"> <b>Request Parameters</b> </th> </tr> <c:forEach items="${paramValues}" var="parameter"> <tr> <td><c:out value="${parameter.key}"/></td> <td colspan="2"> <c:forEach var="value" items="${parameter.value}"> <textarea rows="2" cols="50"> <c:out value="${value}"/> </textarea> </c:forEach> </td> </tr> </c:forEach> <tr> <th colspan="3" style="background:orange"> <b>Header Values</b> </th> </tr> <c:forEach items="${header}" var="h"> <tr> <td><c:out value="${h.key}"/></td> <td colspan="2"> <textarea rows="2" cols="50"> <c:out value="${h.value}"/> </textarea> </td> </tr> </c:forEach> <tr> <th colspan="3" style="background:orange"> <b>Initialization Parameters</b> </th> </tr> <c:forEach items="${initParam}" var="parameter"> <tr> <td><c:out value="${parameter.key}"/></td> <td colspan="2"> <textarea rows="2" cols="50"> <c:out value="${parameter.value}"/> </textarea> </td> </tr> </c:forEach> <tr> <th colspan="3" style="background:orange"> <b>Cookies</b> </th> </tr> <c:forEach items="${cookie}" var="mapEntry"> <tr> <td rowspan="8"><c:out ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required