How to debug JSP

J

John

Hi

I know the following questions on JSP are too general, but hope you won't
mind telling me again.

my a.jsp
<%@ page session="true" %>
<%
while( 1>=100 )
{
out.println("false");
{
}
%>

questions:
1.using Tomcat 5.1 and orion 2.0 for this a.jsp, will these two servers
generate same a.jsp.servlet.java?
2. how to see the generated servlet.java?
3.how to understand to error (the following error message is from orion)

Error parsing JSP page /a.jsp

Syntax error in source/a.jsp.java:35: 'catch' without 'try'
catch(Throwable __jspE2)
^
/a.jsp.java:20: 'try' without 'catch' or 'finally'
try
^
/a.jsp.java:46: '}' expected
}
^
3 errors
it's obvious that the only error is the extra { in line 7; but if a.jsp is
very complicated, how to debug it (writting in a servlet and test this
servlet if okay then pasting back to jsp?)
 
T

Tor Iver Wilhelmsen

John said:
1.using Tomcat 5.1 and orion 2.0 for this a.jsp, will these two servers
generate same a.jsp.servlet.java?

Not necessarily. Both will generate some servlet source file with all
of "your" code put in a method _jsp_init(); what the file is called,
or where it ends up, is implementation dependent.
2. how to see the generated servlet.java?

There probably is some configuration parameter to have it keep the
source around.
3.how to understand to error (the following error message is from orion)

See above.
it's obvious that the only error is the extra { in line 7; but if a.jsp is
very complicated, how to debug it (writting in a servlet and test this
servlet if okay then pasting back to jsp?)

Try compiling the JSP manually, using Jasper in Tomcat:

java -classpath <big classpath> org.apache.jasper.JspC ...

Finding out what goes into the classpath, and how the arguments are
built up, are left as excercises for the reader. :)
 
J

John

Try compiling the JSP manually, using Jasper in Tomcat:
java -classpath <big classpath> org.apache.jasper.JspC ...
Thanks, and

I've set up classpath and tried:

A.
java org.apache.jasper.JspC -uriroot . a.jsp

log4j:WARN No appenders could be found for logger
(org.apache.jasper.compiler.JspRuntimeContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/tools/ant/AntClassLoader
at org.apache.jasper.JspC.initClassLoader(JspC.java:1016)
at org.apache.jasper.JspC.processFile(JspC.java:767)
at org.apache.jasper.JspC.execute(JspC.java:908)
at org.apache.jasper.JspC.main(JspC.java:196)

B.
java org.apache.jasper.JspC -uriroot \ a.jsp

log4j:WARN No appenders could be found for logger
(org.apache.jasper.compiler.JspRuntimeContext).
log4j:WARN Please initialize the log4j system properly.

How to fix it?
 
J

John

Thanks, Tor Iver Wilhelmsen
java -classpath <big classpath> org.apache.jasper.JspC ... ...

Finding out what goes into the classpath, and how the arguments are
built up, are left as excercises for the reader. :)

I've found out it's
jspc -uriroot \fold-jsp-contained

and the default destination folder is tmp
 

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

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,237
Latest member
AvivMNS

Latest Threads

Top