• Post Reply 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

servlet mapping

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application I placed a newEnquiry.jsp in enquiry directory of my project. Form in it is calling NewEnquiryServlet without any problem.

Jsp Code:


Servlet Code:



I have another JSP file in same enquiry directory 'errorEnquiry.jsp' which is calling another servlet ReconfirmationServlet. But it is causing a error 404 servlet does not exist. When calling code and dirctory structure is same as above jsp.

Code for errorEnquiry.jsp


Code for reconfirmation servlet is


Web xml is


Directory Structure is

project/enquiry/newEnquiry.jsp
project/enquiry/reconfirmation.jsp

WEB-INF/classes/com/inventa/enquiry/NewEnquiryServlet
WEB-INF/classes/com/inventa/enquiry/Reconfirmation

Kindly suggest me how to solve this issue when ever i click submit button in reconfirmation.jsp it automatically adds /enquiry/ url before servlet name but no so in case of newEnquiry.jsp and causing error to display.

How should i solve this problem
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are using relative paths in your JSP pages and servlets. I would suggest to use absolute paths (beginning with '/'), this should solve your problem.
 
gurneeraj singh
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if i use absolute path like /reconfirmation in my jsp it takes the page out of scope of apllication like;

http://localhost:80084/reconfirmation

instead of

http://localhost:8084/projectName/reconfirmation
 
Frank Eichfelder
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's true, therefore you should add

to your servlet code and

to your jsp-pages.
 
gurneeraj singh
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank,

Your solution must solve my problem.

But now i am facing a strange problem, when ever i click a link for any jsp file or servlet, web browser starts downloading it instead displaying it on the browser.

What can be the error or my ide got currupted?
reply
    Bookmark Topic Watch Topic
  • New Topic