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 is the directory structure of a war file?
What is servlet instance?
What do you mean by servlet?
What do you mean by httpservlet and how it is different from the genericservlet?
What is the difference between jsp and servlet life cycle?
What’s the use of the servlet wrapper classes??
List out difference between a JavaBean from a Servlet?
Difference between httpservlet and generic servlets?
What do you mean by annotations in servlet?
What is the use of httpservletresponsewrapper?
What is the life cycle of a servlet?
What is ServletContext object?
Differentiate between the get and post method
How to create war file?
What if we pass negative value in load-on-startup?