This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I am trying to make a login servlet code with JSP. The first page is a login page where there is a username and password field. Now on clicking on submit i want the JSP to send those values to the servlet where it can be verified and then redirected to the corresponding page. Could you please tell me what should i do to do this? Righ now my Login.jsp looks like this:
Somnath Mallick wrote:POST sends the data as a part of the message body. That's what i know!
what data ? its includes form data , all fields in the form are submitted to the action called. Its done automatically during form submission.
As said in above post , use request.getParameter() to get values for the submitted data.
Joined: Mar 04, 2009
Well it seems that i am running into some problems of a different kind! I have exported the war file deployed it on a JBoss server from the admin console, then when I open the the URL http://localhost:8080/HealthCheck/Login.jsp the fields come in filled with the value "admin" in username field and some value in the password field!
Also would like to ask.. That i want to send the data of the JSP to the servlet so the action parameter would contain the Servlet name right (in my case it is B2BLogin)?
If the servlet is in the same context as the JSP then we can just use the "B2BLogin" as the action ,
but if the servlet is in different context then we should give the complete path with the context.
How ever it will be a best practise to use complete path always.