View Full Version : jsp forward question

03-21-2012, 12:20 AM

I want to forward the post request of my form to the servlet LoginServlet exactly as if I make action="LoginServlet" in my form. My form is in LoginForm.jsp and this is my approach :

Content of LoginForm.jsp

if (request.getMethod().equals("POST"))
// ... Some checks
<jsp:forward page="/LoginServlet"/>
<form action="LoginForm.jsp">
<input type="text" name="username">
<input type="password" name="userpass">
<input type="submit" value="submit">

So I don't know about the slash in the <jsp:forward page="/LoginServlet"/> if it is mandatory or useless. After that, the LoginServlet servlet should be able to capture the post data with doPost and doGet procedures.


03-21-2012, 10:07 PM
If it is a servlet it should be configured in your web.xml file.

Check how the path is configured in the web.xml and type it here.

03-22-2012, 05:34 AM
Hi friends,
I know that the jsp is used to develop the website in the java language. I know that the main aim of the jsp is to provide the security in your website. I know that session is the main key tools of the JSP page.
JSP forword is used in website to forword the request into the server. Servlet is also used in this java programming .
Thanks .