I have a login page where user information is collected passed to the servlet where it is connected to DAO class where it validates the email received with the database.If emails are different it will provide new userid for that user sends it to register.jsp.Now the user enters the password and all the in formation should be stored in the database.How to connect to the servlet now? Is the same servlet we have to use( if so how and what method we have to use?)If different servlet how it is?I am using MVC architecture.
Please suggest me.
KH
You can use different Servlet or same servlet .
But as if you find some information about MVC it is said that Servlet should be made as controller and how it is made is by using only single servlet and giving wildcard mapping for servlet .
One of the topic may help you is https://coderanch.com/t/359118/Servlets/java/Wildcard-servlet-mappings-web-xml OR you can also search for the wildcard mapping for servlet .
You can use different Servlet or same servlet .
But as if you find some information about MVC it is said that Servlet should be made as controller and how it is made is by using only single servlet and giving wildcard mapping for servlet .
One of the topic may help you is https://coderanch.com/t/359118/Servlets/java/Wildcard-servlet-mappings-web-xml OR you can also search for the wildcard mapping for servlet .
- Chetan
Guys correct me if anything doesn't seems right.
Hi,
thanks for the reply.But i did not get how to retrieve the values from second jsp form in the same servlet.Also i got 405 error saying get method is not supported by the url when i gave /* in servlet mapping.
Thank u.
Kavitha Gh
I'm attaching the file form.jsp where i get info initially and goes to servlet for validation.Then comes web.xml where i map.Now i send some uid to register.jsp.in this jsp, user is allowed to enter password and here i want this to go to same servlet and thereby the data is stored into database.Is it possible and correct?How can it be achieved?
Thank u.
Kavitha hebbar
form.jsp
After this using a servlet which overrides dopost method and there i retrieve values from form.jsp thru request.getparameter.I don't know how to pass from register.jsp to same servlet and how to retrieve values.
Please help me.
You can give same name in the action which you have given in form.jsp .
The problem is how you will decide that how decide from where servlet is called , for this you can add one hidden field in the form having value "REGISTER_FORM" and you can then easily distinguish.