• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Simple login form project - all attributes are null and HTTP Status 404 error in some cases

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That gives only Bachelor's Degree because I have 3 users and all of them has Bachelor's Degree.
 
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
Oh so sorry I got that and fixed it. Now it gives Bachelor's Degree in combo box.
 
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
Copy and paste this in EditPage.jsp. You are to replace what is in between the <td> and </td>



and tell if the combo changes.
 
Paul Ngom
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
Ok, fine. What is the next error message you are having?
 
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
Only HTTP Status 404 message left. It appears when I clicked on SignUp then "Submit", or after logged in Edit then "Submit".
 
Paul Ngom
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
Let us amend Edit.java first. Replace the method doGet by doPost and remove the other doPost. And don't you think there is a problem with this code?


you are receiving from the session and back to the session. I think you should rather issue request.getParameter() on those attributes.
 
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
Should I use request.getParameter in that part instead of session.getAttribute? Sessions look complicated to me I couldn't figure out how they work.
 
Paul Ngom
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


Should I use request.getParameter in that part instead of session.getAttribute?


Yes, make that modification. Hope you have also replaced the doGet.
 
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
Yes. I change doGet method name to doPost, delete other doPost, and use request.getParameter.
 
Paul Ngom
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
In EditPage.jsp, you said you have an error 404 when you hit the submit button. Do you have the Edit.class in the right directory? It uses EditDetails.class, LoginDao.class and UpdateUser.class as well. So make sure those files are in the right directories.
 
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
It should be in the right directory (I think). In my first post there is a screenshot of my project explorer.
 
Paul Ngom
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
Have you compiled the .java files?
 
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
Yeah there are no errors for all my .javas. It is almost 02 AM here so bed time for me
 
Paul Ngom
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
Another thing, since you do not use LoginDao in Edit.java and Registration.java, you can remove this in those files.
 
Paul Ngom
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
Ok. Good night and catch you tomorrow.
Regards
 
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
I copied and pasted most of the import part from LoginServlet. That is why Edit and Registration have import com.amzi.dao.LoginDao. I deleted them now.
 
Paul Ngom
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
Good morning,
Do you still have the error 404 on Edit servlet that is called from EditPage.jsp?
 
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
Good morning Paul,
Yeah I have still status 404 error. May it be because of my form actions? If I post here every URL that appears in browser box, will it help you to find out the problem?
 
Paul Ngom
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
rather post Edit.java servlet.
 
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
Here it is:
 
Paul Ngom
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
I see no problem with the code. Try to reload the page in browser when the error appears and see if you get the same error. Also post the url.
 
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
It is still the same. URL: http://localhost:8080/loginpage/Edit
 
Paul Ngom
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
stop and restart the glassfish server. Call Edit servlet directly from browser using the url that you provided previously. Tell what happens
 
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
This time it gives 405, when i directly run edit.java
HTTP Status 405 - HTTP method GET is not supported by this URL

type Status report

messageHTTP method GET is not supported by this URL

descriptionThe specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

GlassFish Server Open Source Edition 3.1.2
 
Paul Ngom
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
Now log in your web app, navigate to the EditPage.jsp and hit the submit button for the current record. Tell then what happens
 
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
Again Status 404
 
Paul Ngom
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
To be frank if your compiled servlets are in their right directories, i cannot find why it not working. You can create a new topic in forum and see if somebody can help so that we can advance.
 
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
Okay Paul I will. And thanks so much for your help. You helped me a lot.
 
Paul Ngom
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
All is well. As soon as that problem is solved, we could then proceed with the rest. Try to give a detail explanation of the problem in your post.
 
Paul Ngom
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
Please make your sign up page SignUpPage.jsp to look like this:
 
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
I corrected but still same. By the way I have created a new topic as you said. If you wanna follow, link is https://coderanch.com/t/634035/Servlets/java/HTTP-Status-Error-basic-login
 
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
Hey Paul again,
I'm searching to solve this status 404 problem for days. And most problems solved with some web.xml changes about servlet and servlet-mapping. Is my glass fish-web.xml correct (it is created automatically and I didn't change anything)? Should I add sty there? Because <servlet> tag is not working there.
 
Paul Ngom
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


Should I add sty there?



I think you can leave it as it is.
 
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
Hi Paul,
When I click on Submit button after sign up process. This page appears:

And for a logged in user, after editing information and clicking on Submit button. This page appears:


Also there is no change in database too.
 
Paul Ngom
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
Let us deal with Edit first. Inside that servlet, this test is done:


there is no field having the name 'submit' in EditPage.jsp. It should rather be submit1
 
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
Yeah I corrected. Now console shows an error: Error: Error: Parameter index out of range (1 > number of parameters, which is 0).
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this in UpdateUser.java


The query is not well done. It should be


Try that and let us know the outcome.
 
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
Now it says:
UPDATE failed!

Back to Edit Page.
(I changed error message before).

It is because of return_code = 0. And it has never never changed in UpdateUser.java. It looks like some part of the code is missed.
 
Paul Ngom
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
Let us debug. Add these lines in Edit.java just after session.setAttribute("degree",degree):


and see if all values are correctly passed.
 
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
null
null
alifakms
yavuzcais
[email protected]
Doctoral Degree
UPDATE failed!

Back to the Edit Page.
 
reply
    Bookmark Topic Watch Topic
  • New Topic