JSP error
[nobr]I am learning how to use JSPs, and I am running into some trouble. Here is my code for the JSP that I am trying to run using Apache Tomcat version 5.5:
<HTML>
<HEAD>
<!-- Example2 -->
<TITLE> JSP loop</TITLE>
</HEAD>
<BODY>
<font face=verdana color=darkblue>
JSP loop
<BR> <BR>
<%!
public String writeThis(int x)
{
String myText="";
for (int i = 1; i < x; i )
myText = myText"<font size=" i" color=darkred face=verdana>VisualBuilder JSP Tutorial</font><br>" ;
return myText;
}
%>
This is the error that I am recieving when I try to open it from http://localhost:8080/secondjsp.jsp .
Exception report
message
description The server encountered an internal error () that prevented it from fulfillingthis request.
exception
org.apache.jasper.JasperException: Unable to compileclassfor JSP:
An error occurred at line: 14 in the jsp file: /secondjsp.jsp
Syntax error, insert"AssignmentOperator ArrayInitializer" to complete ForUpdate
11:public String writeThis(int x)
12:{
13: String myText="";
14:for (int i = 1; i < x; i )
15:myText = myText"<font size=" i" color=darkred face=verdana>VisualBuilder JSP Tutorial</font><br>" ;
16:
17:return myText;
An error occurred at line: 15 in the jsp file: /secondjsp.jsp
Syntax error on tokens, delete these tokens
12:{
13: String myText="";
14:for (int i = 1; i < x; i )
15:myText = myText"<font size=" i" color=darkred face=verdana>VisualBuilder JSP Tutorial</font><br>" ;
16:
17:return myText;
18:}
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.
I looked around a little bit, and I think that maybe I messed up when setting the ClassPath. I couldn't find a clear answer though. I'm using a tutorial to learn this. Here is the link to that: http://www.visualbuilder.com/jsp/tutorial/pageorder/13/
I'd appreciate any help or advice you could give me.
Thanks,
RH[/nobr]

