java - JSP info page debug helper -
does has uses jsp debug helper page can dropped webapp or included within jsp page view header, req , session attributes?
can please share if possible ? great many
- drop
pagedebugger.jsp
in webapp - access page directly or include jsp like,
layout.jsp
show details on every page - this page lists following in table
- request parameters
- page scoped attributes , values
- request scoped attributes , values
- session scoped attributes , values
- application scoped attributes , values
- request headers
- all spring beans defined in scope
- option search resource on classpath
- dependency on spring framework optional remove if dont use
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <head> <style type="text/css"> td { word-wrap: break-word; } </style> </head> <body> <table width="100%" border="1" cellpadding="0" cellspacing="0" style="table-layout: fixed;"> <colgroup> <col width="500"> </colgroup> <tr> <th colspan="2"> <h3>attributes in $paramvalues</h3> </th> </tr> <c:foreach var="entry" items="${paramvalues}"> <tr> <td><c:out value="${entry.key}" /></td> <td><c:foreach var="item" items="${entry.value}" varstatus="status"> <pre><c:out value="${item}" /></pre> <c:if test="${not status.last}"> <br /> </c:if> </c:foreach></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>attributes in $requestscope</h3> </th> </tr> <c:foreach var="entry" items="${requestscope}"> <tr> <td><c:out value="${entry.key}" /></td> <td><pre><c:out value="${entry.value}" /></pre></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>attributes in $sessionscope</h3> </th> </tr> <c:foreach var="entry" items="${sessionscope}"> <tr> <td><c:out value="${entry.key}" /></td> <td><pre><c:out value="${entry.value}" /></pre></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>attributes in $pagescope</h3> </th> </tr> <c:foreach var="entry" items="${pagescope}"> <tr> <td><c:out value="${entry.key}" /></td> <td><pre><c:out value="${entry.value}" /></pre></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>attributes in $headervalues</h3> </th> </tr> <c:foreach var="entry" items="${headervalues}"> <tr> <td><c:out value="${entry.key}" /></td> <td><c:foreach var="item" items="${entry.value}" varstatus="status"> <pre><c:out value="${item}" /></pre> <c:if test="${not status.last}"> <br /> </c:if> </c:foreach></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>attributes in $applicationscope</h3> </th> </tr> <c:foreach var="entry" items="${applicationscope}"> <tr> <td><c:out value="${entry.key}" /></td> <td><pre><c:out value="${entry.value}" /></pre></td> </tr> </c:foreach> <tr> <th colspan="2"> <h3>system properties</h3> </th> </tr> <tr> <th>key</th> <th>value</th> </tr> <%@page import="java.util.map"%> <%@page import="java.util.set"%> <%@page import="java.util.properties"%> <%@page import="java.util.arrays"%> <% properties p = system.getproperties(); set<map.entry<object, object>> set = p.entryset(); (map.entry<object, object> e : set) { %> <tr> <td><%=e.getkey()%></td> <td><%="".equals(e.getvalue()) ? " " : e.getvalue()%></td> <% } %> </tr> <tr> <th colspan="2"> <h3>spring beans</h3> </th> </tr> <%@page import="org.springframework.web.context.webapplicationcontext"%> <%@page import="org.springframework.web.context.support.webapplicationcontextutils"%> <%@page import="org.springframework.core.io.resource"%> <% try { webapplicationcontext springcontext = webapplicationcontextutils .getwebapplicationcontext(config.getservletcontext()); if (springcontext != null) { string[] beannames = springcontext.getbeandefinitionnames(); arrays.sort(beannames); (string beanname : beannames) { string classname = springcontext.gettype(beanname) .getname(); %> <tr> <td><%=beanname%></td> <td><%=classname%></td> </tr> <% } %> <tr> <th colspan="2"> <h3>spring resources</h3> </th> </tr> <tr> <th colspan="2"> <form><input name="resources" size="50"/></form> </th> </tr> <% string resourcenames = request.getparameter("resources"); if (resourcenames != null) { resource[] resources = springcontext .getresources(resourcenames); (resource r : resources) { %> <tr> <td><%=r.getfilename()%></td> <td><%=r.geturi()%></td> </tr> <% } } } } catch (exception e) { e.printstacktrace(); } %> </table> </body> </html>
additionally if have option modify web.xml, have @ these can used monitor / profile active http session attributes
Comments
Post a Comment