Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calling jsp from servlet

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
i was trying the example given in ch 3 of head first for jsp and servlets...
the application was working fine until the last step where jsp is used to show the result page..
the following exception occurs..
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/web.xml: (line 6, col 21)
org.apache.jasper.compiler.JspConfig.processWebDotXml(JspConfig.java:185)
org.apache.jasper.compiler.JspConfig.init(JspConfig.java:198)
org.apache.jasper.compiler.JspConfig.findJspProperty(JspConfig.java:250)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:113)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
BeerSelect.doPost(BeerSelect.java:22)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729).......


this are my codes
BeerSelect.java

BeerExpert.java

result.jsp

web.xml

directory structure in tomcat is like this
webapps
|
beerv1
|-form.html , result.jsp
WEB-INF
|-web.xml
classes
|- BeerSelect.class, BeerExpert.class
 
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

List styles = (List)requst.getAttribut("styles");



Please correct the TWO spelling mistakes... !!!
 
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Read the first line of the error message carefully.

ankur tyagi wrote:org.apache.jasper.JasperException: XML parsing error on file /WEB-INF/web.xml: (line 6, col 21)



Are you sure the following line is correct in your web.xml?

ankur tyagi wrote:


Also, correct the spelling mistakes pointed out by James.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
about the xml file ..
this line was working fine before...
and even after correcting the spelling mistakes ,the error is still there..
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

ankur tyagi wrote:about the xml file ..
this line was working fine before...


After checking that it was working, what changes did you make that made the server go mad?
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
What is the current error message??
Hope you re-deployed server
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
no changes in the xml file only the changes in the BeerSelect.java file as you can see in
the code to call the result .jsp file to make the output page..
previously the servelt itself was showing the output ...


the error remains the same..
yes, restarted the server if that is re-deployment means..
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

ankur tyagi wrote:no changes in the xml file only the changes in the BeerSelect.java file



Hope you changed the result.jsp as i mentioned in my first post.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

ankur tyagi wrote:about the xml file ..
this line was working fine before...
and even after correcting the spelling mistakes ,the error is still there..


i told you that before..
yes i corrected the spell mistakes..
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Just compared your code with the book. The line in web.xml mentioned in my first post here is indeed different from how it is in the book. Can you check again?
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
the difference is in encoding
the one in the book is ISO-8...
but i am using UTF-8..
because that one was not working for me , someone suggested me UTF on javaranch..
i told you it was working , the problem started when i used result.jsp
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
The error is in your web.xml, as per the error message:Why do you not believe it? You might *think* it worked before, but I guarantee you it did not. Look at where you define your namespaces:I've edited it to make the error easier to spot. Next time pay attention to the error message, and be careful about making assumptions about what's wrong.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
i am still unable to spot the error...
i have no knowledge of xml all i know is that it is used to map servlet class with
url name..
i copy pasted the code from the book..
if you can elaborate the error you see in the code , it will be nice..please
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
"xmls" is wrong.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
thanks for that..now the error is in the result.jsp file
An error occurred at line: 7 in the jsp file: /result.jsp
List cannot be resolved to a type
same error is returned for iterator and second occurrence of list ...
i figured it out ..
its working now
thanks again
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic