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:
getServletContext().setAttribute("variableName",object);
Then u have to forward that request to other servlet by
using that procedure,
RequestDispatcher rd=getServletContext
().getRequestDispatcher("/servlet");
rd.forward(request,response);
U can get that information from that servlet by using the
method::
getServletContext().getAttribute("variableName");
| Is This Answer Correct ? | 23 Yes | 10 No |
Post New Answer View All Answers
What is a servlet context?
How can I send user authentication information while making URL Connection?
Does servlet have main method?
What's the difference between servlets and applets?
How do you create a cookie using servlet?
Why HttpServlet class is declared abstract?
What is the purpose of requestdispatcher interface?
What are the various ways of session supervision in servlets?
Explain the difference between servlet and cgi?
What do you mean by chaining in servlet?
What is the default http method in the servlet?
Explain web container.
Explain the differences between jsp and servlet.
What are the common methods that are included in the http servlet class?
When Servlet is unloaded?