• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

HTTP Status 404 Error in basic login form

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,
I'm trying to learn java by making a login page using java, servlet, javascript, html and mysql.
I can login with username and password, I can get all the information from database in the edit page. However, when I edit and click on "Submit" in EditPage.jsp, it gives HTTP Status 404. Same screen appears when I click on "Sign Up" from first page (NewFile.jsp) and click on "Submit" button after filling up user information.

I am posting all my code here but probably important ones are: EditPage.jsp, Edit.java, EditDetails.java, UpdateUser.java and for Sign Up SignUpPage.jsp and Registration.java.

Firstly here are my error message and ss from my project explorer:




Here is my code:

LoginServlet.java


Edit.java


Registration.java


glassfish-web.xml
 
Rancher
Posts: 43027
76
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is mapped to /Edit? Two of the servlets are mapped to something else, and one servlet isn't mapped to anything AFAICT.

I took the liberty of deleting a bunch of stuff that has no bearing on a 404.
 
K. Karacakaya
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 3 form actions. One of them is in NewFile.jsp: <form action = "LoginServlet" method = "post"> This one is for submitting username and password. One of them is in SignUpPage.jsp: <form action="Registration" method="post"> This one is submitting register page. And the last one is in EditPage.jsp: <form name="frm1" action= "Edit" method = "post"> to submit edited information.
It looks like 1st one is working and rest are not working and I couldn't figure out why. BTW I'm new in Java web.
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

... LoginServlet ... Registration ... Edit...

It looks like 1st one is working and rest are not working



The first one is mapped (in LoginServlet.java), the other two are not. The URL you need to use is determined by the "@WebServlet" annotation. There is no such annotation in Registration.java , and the one in Edit.java points to a different URL (/UpdateCustomerServlet).

As a general practice I recommend that you remove the word "servlet" from any mappings, for example you might have "Register", "Login" and "Edit".
 
K. Karacakaya
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks much Ulf. Status 404 problem is solved
 
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Ulf.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic