Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Unprecise error line number on JSP compilation

Thread view: 
ennio - 04 May 2007 12:07 GMT
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
Lew - 04 May 2007 14:10 GMT
> Tomcat 5.5 ... this is the JSP:
> ----------------------CUT-------------------
[quoted text clipped - 10 lines]
> 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.

Signature

Lew

Wojtek - 07 May 2007 14:26 GMT
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.

Signature

Wojtek :-)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.