How to get the line number if exception occurs in jsp page

This and other problems made me reduce the Java code in JSP pages to the absolute minimum. I create helper objects for everything I need to do in a JSP page which contains the meat of the Java code (which means I can unit test this code as well).

The JSP then only contains the bare minimum:

<%Helper tool = new Helper();%>

<%=tool.foo()%>

Every JSP is converted to a servlet on runtime, which means you should look for the generated servlet code. In Tomcat it is in the work/ folder, but to make sure, search for the index.jsp.java file in your servlet container's folder.

Tags:

Java

Servlets

Jsp