2

Suppose, I've set a breakpoint in a JSP page. The debugger has stopped at that line. How to evaluate JSTL EL expression in a debug session instead of sending result to a browser every time the expression is being changed? I use IntelliJ IDEA. Habitual 'ALT+F8' (evaluation window) doesn't work.

UPD: in other thread the questioner said 'The debugger never hits' the breakpoints. But in my case the execution stops, but I don't know how to evaluate EL expression without sending the result to a browser.

Community
  • 1
  • 1
beemaster
  • 291
  • 1
  • 3
  • 13
  • Possible duplicate of [JSP debugging in IntelliJ IDEA](http://stackoverflow.com/questions/33739/jsp-debugging-in-intellij-idea) – Peter Mar 23 '16 at 09:53

1 Answers1

1

After investigating of the code of the class generated by Tomcat based on my JSP file I found 2 ways:

  1. If you want just to check the value of a request param used in an EL expression you can type into "Evaluate Expression" window the following:
    ((PageContext) pageContext).findAttribute("paramName")
    or other "get" method of javax.servlet.jsp.PageContext class instead of findAttribute().
  2. If you want to evaluate the exact expression type the following:
    org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${yourExpressionHere}", java.lang.String.class, _jspx_page_context, null, false)
    but before you have to add Tomcat's library jasper.jar into you project. Class org.apache.jasper.runtime.PageContextImpl is described in Tomcat's API docs.
beemaster
  • 291
  • 1
  • 3
  • 13