Unprecise error line number on JSP compilation

E

ennio

Thanks very much to anybody who can help.
I am using Tomcat 5.5 and when i compile a jsp i'm facing this
problem.
If the Jsp contains an error in a java script, tomcat doesn't print
out the number where the compilation occurs, but prints out the
beginning of the java script.
Example:

this is the JSP:
----------------------CUT-------------------
<%
out.println("1");
out.println("1");
out.println("1") //Missing something here!
out.println("1");
%>
----------------------CUT-------------------

this is the error:
----------------------CUT-------------------
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /engineeringcentral/
custom/GD_ProveEnrico.jsp
Generated servlet error:
Syntax error, insert ";" to complete Statement

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:
84)
[....]
----------------------CUT-------------------


But i would like to get:
An error occurred at line: 4
instead of 1.
This is very important in complex jsp's.
I think i my previous tomcat (4.1) it worked so, but it doesn't
anymore. Is it a kind of setting?
Thank you very much
 
L

Lew

ennio said:
Tomcat 5.5 ... this is the JSP:
----------------------CUT-------------------
<%
out.println("1");
out.println("1");
out.println("1") //Missing something here!
out.println("1");
%>
----------------------CUT-------------------
An error occurred at line: 1 in the jsp file: /engineeringcentral/
----------------------CUT-------------------
But i would like to get:
An error occurred at line: 4
instead of 1.

AFAIK all that scriptlet represents a block of whitespace to a JSP, hence it's
all one line in JSP terms.

I doubt we can change that without rebuilding Tomcat. You might find avenues
to express your opinion directly to the tomcat people on their project site.
 
W

Wojtek

ennio wrote :
Thanks very much to anybody who can help.
I am using Tomcat 5.5 and when i compile a jsp i'm facing this
problem.

It gets better. When your try to use an object which has not been
created, all you get is a "Jasper Exception".

So with myRef.getStuff(), if myRef is null becuase you forgot to set
it, the runtime will produce a Jasper Exception, but it does NOT tell
you where it is, or what even caused it.

The usual cause is a null reference, but it may be anything.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top