I've got this error when i try to run this JSP file.
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: 17 in the jsp file: /JSP/helloworld.jsp
Syntax error, insert "AssignmentOperator Expression" to complete ForUpdate
14: public String writeThis(int x)
15: {
16: String myText="";
17: for (int i = 1; i < x; i)
18: {
19: myText = myText;
20: return myText;
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:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
AND this is my JSP code.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>...</title>
</head>
<body>
<font face="Verdana, Arial, Helvetica, sans-serif" color="darkblue">
JSP Loop
<br /><br />
<%!
public String writeThis(int x)
{
String myText="";
for (int i = 1; i < x; i)
{
myText = myText;
return myText;
}
}
%>
This is an loop example:
<br />
<%= writeThis(8) %>
</font>
</body>
</html>
Question
Nikas
I've got this error when i try to run this JSP file.
AND this is my JSP code.
Anything wrong with this code ?
Thanks..
Nikas
Link to comment
Share on other sites
2 answers to this question
Recommended Posts