Last active
August 31, 2015 19:22
-
-
Save nateperry/c5ecebe34e3cf8cb53ed to your computer and use it in GitHub Desktop.
Simple JSP Object Detailer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%-- | |
Prints out all properties of a particular object | |
Slightly Revised version from original: http://stackoverflow.com/a/24576688 | |
--%> | |
<c:set var="object" value="${SOMEOBJECT}" /> | |
<c:if test="${!empty object.class.declaredFields}"> | |
<h2>Object Attributes <em>${object.name}</em></h2> | |
<ul> | |
<c:forEach var="attr" items="${object.class.declaredFields}"> | |
<c:catch><li><b>${attr.name}</b>: ${object[attr.name]}</li></c:catch> | |
</c:forEach> | |
</ul> | |
</c:if> | |
<%-- Displays Java Methods --%> | |
<c:if test="${!empty object.class.declaredMethods}"> | |
<h2>Object Methods<em><% object.getName() %></em></h2> | |
<ul> | |
<c:forEach var="attr" items="${object.class.declaredMethods}"> | |
<c:catch><li>${attr.name}</li></c:catch> | |
</c:forEach> | |
</ul> | |
</c:if> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment