Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in compiling Jsp

 
Vasanth Raja.K.
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Amit Saini
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paste your jsp file here.
 
Vasanth Raja.K.
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing ,my web.xml and classes is under WEB-INF directory.(Not in the picture)
Reg
Vasanth
 
Vasanth Raja.K.
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Priya,
Now it's working Fine.I don't know what really happening.
Anyway,thanks a lot.
Reg
Vasanth
 
Priya Jothi
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic