Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404 -

 
Varnam Aayiram
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • 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..
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4319
236
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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..
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi Bear Bibeault..

I tried this



and it works... Thanks!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic