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
Explain the jar and war files in servlet?
Name the packages that work with servlet?
What is the difference between the http servlet and generic servlet?
What do you mean by cgi in servlet?
Why is init() method is used in servlets?
Elucidate servlet attributes and its scope?
When to use doget() and when dopost()?
How do we translate jsp?
Can you use javascript in servlets?
Can a jsp be called using a servlet?
Can we use the constructor, instead of init(), to initialize servlet?
what do you understand by url rewriting?
What is the requirement of servlet config and servlet context implemented and how are they implemented?
Explain the concept of ssi ?
What are the types of protocols supported by httpservlet ?