JSTL : Display All Request Scope Parameters And Model Attributes Inside JSP Page
One of the most best practices and professional required actions to do before thinking about adding/sending a new model attribute to the jsp page, is to check if you have already an attribute in your jsp that can be used to handle your requirement.
Unfortunately many developers are not aware of this problem and they end up by having duplicated information sending to jsp which apply lot of unoptimized calculation.
But is quite difficult to identify either the needed information is already sent to jsp or not, specially when you’re working on big project.
So the Following trick gives you the ability to display all request scope parameters and model attributes inside JSP page by adding this simple code :
<ul>
<c:forEach items="${requestScope}" var="p">
<li>${p.key} -> ${p.value}</li>
</c:forEach>
</ul>
After refreshing the page you will see all parameters displayed with their values.
Java/JavaEE (Hybris/Spring) & Full Stack Senior Developer
I’m passionate about new technologies or any kind of thing that change our lifestyle to better either by automatisation of existing process or creating new solution.