Prasanjeet Das wrote:
>
> Hi All,
> My problem is the I have a Jsp page which is a registeration form , now
> I post all the form data to another JSP page
> where i validate the data & display the message is the user succefully log's
> in & a unsuccessful message if he cannot log in.
>
> I pass all the data from my 1st jsp page to the 2nd using the following code
> i.e
> RequestDispatcher dispatch =
> getServletConfig().getServletContext().getRequestDispatcher("/jsp/Test/Reg_h
> .jsp");
> dispatch.forward(request,response);
> System.out.println("After Dispatch")
>
> This works fine but the problem is that
>
> When the messgae in the 2nd jsp page is displayed , the From fromat from The
> 1st JSP page is appended at the end , which i do not want
First, if I understand the problem correctly, you see output from the first
page at the end of the page you forward to because you do not stop processing
of the first page after the forward() call. One way to fix this is to add a
return statement after forward():
...
dispatch.forward(request, response);
return;
A better solution is to get rid of all this Java code in the page and use
the JSP action element designed for this purpose instead:
<jsp:forward page="/jsp/Test/Reg_h.jsp" />
or, if the two JSP pages are in the same directory:
<jsp:forward page="Reg_h.jsp" />
In addition to getting rid of all the code, the action also stops the processing
of the first page automatically.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets