Can I forward a local variable to another servlet?
Ken Shamrock
Ranch Hand
Joined: Jan 23, 2002
Posts: 139
posted
0
If I forward or include a servlet B from servlet A, req.getRequestDispatcher(forwardTo).forward(req, res); req.getRequestDispatcher(includeIn).include(req, res); besides forward the req (request) varible by user, can I forward a local/global variable declared inside Servlet A? (eg String a=test; can I forward this 'a' variable to another servlet by forward or include) ? Thanks
Thanks everyone who helped me
Adam Hardy
Ranch Hand
Joined: Oct 09, 2001
Posts: 564
posted
0
Set the variable as an attribute to the request. request.setAttribute("myVar", localVar);
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.