Sending argument from one servlet to another servlet
Joined: Feb 08, 2006
Hi Ranchers, I would like to know how to send an argument(s) from one servlet to another servlet. I know this can be done by using setAttribute and getAttribute methods of ServletContext class. But storing data in servlet context would make it visible to all other servlets. Is there any other way to implement this?
Yes Ben is right, use request.setAttribute() and request.getAttribute() and your values will be available to those two servlets only. I personally use hidden fields ie <input type="hidden" name=myname value=myvalue> mostly.