Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tools to track errors in jsp pages.

 
lokesh reddy
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one tell about the tools for debugging jsp pages. Its very hard to track the errors, that i found in jsp.
Bye.
Loke.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the JSP environment is hard to debug in.
Your most important tool is Java's exception mechanism.
In your <%@ page declaration, establish an errorPage
In your errorPage jsp, you can extract useful information - example in my Servlets and JSP book - this is part of an error page that does special treatment of a NumberFormatException
<%@ page language="java" isErrorPage="true" %>
<% if( exception instanceof NumberFormatException ){
%> Only numeric characters may be entered.<br>
<% } else { %>
<%= exception %>
<% } %>
More advice: design your JSP to make maximum use of Java beans or other components that can be tested separately.
Bill

------------------
author of:
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Bill.
I can only say that I work with IBM's Visual Age For Java 3.5 and that it has a "JSP Execution Monitor".
It lets you see three things at the same time: The source code of the JSP, the corresponding Java code generated from the JSP into a Servlet, and the HTML generated on the fly to be sent to to the HTTP client (browser).
It's not a panacea (I know!) but it's better than nothing...
 
lokesh reddy
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Alicea and William.
Your suggestions are working out for me.
Bye.
Loke.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a simple monitor that intercepts and displays the request and response for servlets and JSP debugging. You can find it and the text of the debugging chapter at:
http://www.lanw.com/books/servletJSP/
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic