How do you pass the data from one servlet to another
servlet?
Answer Posted / debojit
First of all u have to set the value by setAttribute()
method such as:
request.setAttribute("variableName",object);
Then u have to forward that request to other servlet by
using that procedure,
ServletContext con=request.getServletContext();
RequestDispatcher rd=con.getRequestDispatcher("/servlet");
rd.forward(request,response);
U can get that information from that servlet by using the
method::
getAttribute("variableName");
| Is This Answer Correct ? | 50 Yes | 20 No |
Post New Answer View All Answers
What do you mean by cgi and what are its drawbacks?
What is lazy loading and what is Generic Servlet Class?
I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?
What is MIME Type?
How do I use cookies to store session state on the client?
Difference between get and post in java servlets?
What are the functions of the servlet container?
What is difference between PrintWriter and ServletOutputStream?
Write a program to show the functionality of doget and dopost method?
What are the exceptions thrown by servlets? Why?
Can you refresh servlet in client and server-side automatically?
What are Servlets?
Why doesn’t a servlet include main()?
How can we implement a jsp page?
What are the uses of servlets?