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
Why don't we write a constructor in a servlet?
Write a program to show the functionality of servlets.
What is the inter-servlet communication?
What is url encoding and url decoding
What is the difference between Difference between doGet() and doPost()?
Which application server is best for java?
What are the features added in Servlet 2.5?
What is Servlets and explain the advantages of Servlet life cycle?
Explain jsessionid?
What are different ways for authentication of servlet?
What is the difference between jsp and servlet life cycle?
What are the different methods of session management in servlets?
What is generic servlet class?
Given the request path below, which are context path, servlet path and path info?
Which java application server is the best?