Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

HTTP Status 404 -

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks...

I am getting the following error when I click on the submit buttin of my form:


HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

descriptionThe requested resource () is not available.





I believe this could be something which people encounter regularly. I am not able to figure out why I am getting this. The the form 'action' in jsp is pointing to the correct servlet I want and in the web.xml file, the servlet is declared as well...yet I am gettting this error...The codes are as follows:

sysuserBookingForm.jsp


sysuserBookingFormServlet


web.xml



I really hope someone can advise. Thanks..
 
Sheriff
Posts: 6886
1312
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please IsolateTheProblem instead of posting the whole lengthy code of your Servlet.

For now, what I can guess is, your problem might be with the following statement

request.getRequestDispatcher("bookingConfirmed.jsp").forward(request, response);

Are you sure that bookingConfirmed.jsp exists? Also, you may also want to insert a forward-slash at the beginning:
/bookingConfirmed.jsp
 
Varnam Aayiram
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Devaka Cooray ...

Thanks for the reply. I have commented out this line:


I was hoping now this line will get printed to the browser



But it's not, I am still getting the same error as before..
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Varnam Aayiram wrote:

I was hoping now this line will get printed to the browser



But it's not, I am still getting the same error as before..


That statement is never processed. You are sending a POST request and the doPost() in the code that you posted, doesn't lead to that statement.
 
Varnam Aayiram
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran Pai ..

Thanks for pointing it out to me. I am still having the problem and I now suspect it's something to do with the folders. All I want to do now is just to make sure that the servlet gets called and writes "This is a test" when the submit button is clicked on the form.

My folder structure is as follows:




I realise that if I were to place sysuserBookingForm.jsp outside the 'sysuser' folder(as in within the Webpages folder but not under any subfolder), and run the project, the form opens up and I click on the submit button, the servlet is invoked and "This is a test" appears in the browser, which is exactly what I want. However this dosen't happen when the sysuserBookingForm.jsp is within the sysuser folder. Do I have to make changes to the form action? I tried the following, this:


was changed to this:


It still gives me the same error. What then is the correct way to call/invoke the servlet from a jsp file that is located in a subfolder of the WebPages folder?

 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You action should be a server-relative URL, beginning with the context path that matches the mapping of the servlet. Anything else will not work.
 
Varnam Aayiram
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear Bibeault..

I tried this



and it works... Thanks!!!
reply
    Bookmark Topic Watch Topic
  • New Topic