aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Problem in compiling Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Problem in compiling Jsp" Watch "Problem in compiling Jsp" New topic
Author

Problem in compiling Jsp

Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
Hi,
While working in JSP i got the error like this.
Unable to compile jsp.Can u figure it out,If anybody know plz reply.
Reg
Vasanth


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
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:520)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.ArrayIndexOutOfBoundsException: 34
org.apache.jasper.compiler.JspReader.peekChar(JspReader.java:164)
org.apache.jasper.compiler.JspReader.isSpace(JspReader.java:357)
org.apache.jasper.compiler.JspReader.isDelimiter(JspReader.java:440)
org.apache.jasper.compiler.JspReader.parseToken(JspReader.java:405)
org.apache.jasper.compiler.Parser.checkUnbalancedEndTag(Parser.java:1699)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1561)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


SCJP 1.4(85%)<br />SCWCD 1.4(79%)
Amit Saini
Ranch Hand

Joined: Oct 20, 2004
Posts: 280
Paste your jsp file here.
Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
Hi ,this is my HTML File.
<code>
<html><body>
<form action="Test.jsp">
Name:<input type="text" name="name"><br>
ID#:<input type="text" name="empID"><br>
First Food:<input type="text"name="food"><br>
Second Food:<input type="text"name="food"><br>
<input type="submit">
</form>
</body>
</html>
</code>
This is my Jsp File .I just try to get name using EL.
<code>
<html>
<body>
Param Name:${param.name}
</body>
</html>
</code>

My Actual problem is If i put this in my contextpath(ie., my own directory)it's printing like this

Param Name:${param.name}

But If i put it in ROOT directory,it's displaying properly
Param Name:123 ,if name=123 in query string?

Kindly Suggest What is the problem?Plz.I got stuck from this from yesterday onwards.
Priya Jothi
Ranch Hand

Joined: Jul 13, 2004
Posts: 168
Hi Vasanth,

I really dont know what is ur pblm there!!.I copy pasted ur code in my machine & it is perfectly working!!!.

when i enter aaa in name field & hit the submit button the output is as below

Param Name:aaa

Hmmm..i guess the pblm mite be due to web-app structure.Plz ensure that under your working directory u've placed WEB-INF folder & within that
classes folder should be present.See to that ur web-app structure matches the below one.

webapps
|-Test(assuming this is a root directory)
|-sample.html
|-Test.jsp
|-WEB-INF
|-classes

Then it should work!!

Regards,
Priya.
Priya Jothi
Ranch Hand

Joined: Jul 13, 2004
Posts: 168
Oops!!.

The strucure which i drew in the above post is not getting displayed properly.But i hope that u understand what i meant in that.

Revert for further clarifications.

Regards,
Priya.
Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
Hi Priya,
Thanks for ur reply.
I have not put the class folder.Even i put that also it's not working.
But it's perfectly working under root directory.I'm using tomcat5.0.28.
The most funny things,yesterday it's working fine.but today it's not working(although the above line is not meaningful.. it's the fact).I really don't know what to do now.
The only chance i am trying is copy the same file under root directory and working.

Any Suggestions???
Reg
Vasanth
Priya Jothi
Ranch Hand

Joined: Jul 13, 2004
Posts: 168
Vasanth,

When it is working under ROOT directory, ideally it should work if placed in ur working directory also.Juz u can compare the ROOT dir with urs & see what is missing?.BTW did u place web.xml inside WEB-INF folder?.

Regards,
Priya.
Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
Priya,
This is my order under my directory.
|webapps
|---el(my directory)
|----form.html(HTML File)
|----Test.jsp(JSP File)
|-----WEB-INF
|---web.xml
|--classes(directory as per ur wish)

and classes directory doesn't contain anything and
web.xml is


Finally,i got a clue.I went to the directory where the jspFiles are compiled and it's in C:\<tomcat-installation directory>\work\Catalina\localhost\el\org\apache\jsp\Test_jsp.java

Don't confuse with this code.Anyway u are not need this for exam


Note that param name .It's given in out.write.That's why it's printing as it is.
Check ur code and find it if i am right.

Reg
Vasanth
Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
One more thing ,my web.xml and classes is under WEB-INF directory.(Not in the picture)
Reg
Vasanth
Vasanth Raja.K.
Ranch Hand

Joined: May 30, 2005
Posts: 35
Hi Priya,
Now it's working Fine.I don't know what really happening.
Anyway,thanks a lot.
Reg
Vasanth
Priya Jothi
Ranch Hand

Joined: Jul 13, 2004
Posts: 168
Hey thatz cool!!!

neways pasting my code(those 2 lines) for ur reference:

out.write("Param Name:");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${param.name}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));

Regards,
Priya.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in compiling Jsp
 
Similar Threads
From JSP 1.2 to 2.0 problem
JasperException
environmental variable issue
Please help me solving this error
JasperException Error