I’m using Spring MVC and my jsp’s have a
<div id="debug">
section that I would like to be able to show/turn off conditionally while we are in development. For example, if I am looking at page http://www.example.com/main, http://www.example.com/main?debug=1 would show me the information that is contained under the debug div.
Is there an easy way to do this? Can I use a URL parameter, should I use a cookie? I would appreciate any ideas you have.
Set it as context parameter in
web.xml.And access it in EL by
${initParam}which basically refers to aMap<String, String>with all context parameters. Here’s an example with JSTLc:if:There may be more “Springy” solutions for this which I am not aware of. But it’s not that hard with help of standard JSP/Servlet API’s 🙂