Hello all when Im getting page error from the server that tells me the problem but don�t gives me the line number? what is the best way to debug it? how can I add print messages or any other method to check where exactly the page got stock? this is the error im getting : org.apache.jasper.JasperException: Unable to compile class for JSP
Compilers usually have a hard time giving you an accuarate line number for missing quotes anyway. A good text editor (such as VI) will give you a way to check to see which brace matches the one you're on.
Another approach would be to start commenting out large pieces of your JSP until you can get it to compile and run. Start by commenting the whole thing out, if need be, and then start moving the end of the comment up until it breaks again.
As a side note: Someone, earlier in the week, was asking about scriptless JSPs and what the real benefits of them are. These types of problems make a good case for them.
What is happening is that you've missed a semicolon or curly bracket somewhere. Fortunately, this is easy to figure out:
Assume your page is foo.jsp
1) Locate the foo.java that has been generated. If you're running Tomcat, it is probably under the work directory in yourapp/WEB-INF/classes/com/apache/... 2) Take foo.java and load it into your editor (use something good like eclipse that does syntax checking; vi or notepad are not good choices). 3) The editor will tell you in general where the problem is. Try to solve the problem. 4) Back trace to your jsp - you'll see parts of your original code in foo.java and you can figure out from #3 where you went wrong in foo.jsp.
Joined: Mar 22, 2005
On another side note, if you have a JSP with 1500 lines, you should seriously reconsider your design. If for no other reason -and there are quite a few- than that you have already experienced what it does for maintenance and debugging.