I am calling a servlet from a jsp. I want the result from the servlet back into the calling JSP. How do I do this?
Printable View
I am calling a servlet from a jsp. I want the result from the servlet back into the calling JSP. How do I do this?
How are you calling, and what is the result of the servlet?
I am using the action attribute of the Form tag to go to the servlet. The servlet connects to the database, retrieves data. Now i want this data back into the calling jsp.
So it is really the client submitting a form to a servlet?
You could put the data into request attributes and then forward to the JSP. See javax.servlet.RequestDispatcher.
I have used response.sendRedirect() to send Data through the URL. I pick up the data using request.getParamater() from the JSP.
Thanks for your help CornedBee.
Don't use sendRedirect(). It gives an inappropriate HTTP code.
Use the sendResultRedirect() method I presented in this thread:
http://www.vbforums.com/showthread.php?t=450148