Reputation: 233
How do I pass form info from jsp to java to jsp again.
I have this jsp form that when I submit it, it is passed to another jsp page directly that displays those info. But then I want to process those information first in a java file before passing it again to jsp.
I do something like this in jsp..
<form method="POST" action="process.java" >
....
</form>
then on process.java I use request.setAttribute("data") to stored the processed data. But how do I redirect it back to an html view file? Sorry new user here.
Sorry this should be really a common question but i just want a simple answer for it.
Upvotes: 0
Views: 354
Reputation: 11234
You can use redirect in HttpServletResponse
:
response.sendRedirect("next.jsp"); // next.jsp is your next jsp you want to show
By the way, your Java has to extend Servlet API interface to be invoked.
Upvotes: 1
Reputation: 240900
You need to POST your form data to a servlet which is mapped to particular URL for example /process
and container will delegate that request to mapped Servlet
See
Upvotes: 1