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
How do you invoke a servelt?
What do you mean by interservlet communication?
Explain the jar and war files in servlet?
Difference between get and post in java servlets?
Difference between doget and dopost?
Describe in brief RequestDespatcher?
What is servlet in web technology?
Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?
Explain get and post.
What is ServletConfig object?
Why session tracking is needed?
What is difference between get and post method?
How does tomcat servlet container work?
What is the need of servlet filters?
Is tomcat a servlet container?