How do you pass the data from one servlet to another
servlet?
Answer Posted / kuru
for example if you want to pass your name from one servlet
to another,
in fiest servlet file....
String name = "Tom"
request.setAttribute("name",name);
RequestDispatcher dis = request.getRequestDispatcher
("Servlet2");
request.Forward(request,response);
in second servlet file....
request.getAttribute("name");
//this line will display "Tom"
| Is This Answer Correct ? | 46 Yes | 20 No |
Post New Answer View All Answers
What is string tokenizer?
What is the difference between servlet and filter?
Explain the difference between servletconfig and servletcontext in servlet?
What is servlet looping or chaining?
What is the purpose of inter-servlet communication?
Why is httpservlet declared abstract?
What mechanisms are used by a Servlet Container to maintain session information?
What is servlet initializer?
What is preinitialization of a servlet?
How forward () method is different from send redirect () method?
Why do we have servlet wrapper classes?
In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify
Which method of the httpservletrequest object is used?
If servlet receives multiple requests, how many objects will it create?
What is the major difference between servlet and applet?