Discussions

Web tier: servlets, JSP, Web frameworks: How do I pass parameters from one servlet to another?

  1. Hello, my question is i'm trying to pass a parameter(ex. int value)from one servlet to another, then back to the initial servlet. to do a request and response if you will. Could someone help me out I would appreciate it..
                                      Thanks.
  2. Try putting the int value into the session object or set an attribute in the request object and then dispatch the request to the servlet that you want to call.Retrieve the int value from the session.
  3. Use the RequestDispatcher object to forward values from current servlet to any servlet/jsp u want.

    RequestDispatching is also used for servlet chaining