Web tier: servlets, JSP, Web frameworks: response.sendRedirect();

  1. response.sendRedirect(); (3 messages)

      please enlighten as to how to use response.sendRedirect();
    in a jsp page ,wherein u have to redirect the cursor to different pages depending on condition the end user selects.
    eg>> during use of radio buttons

    problem --does not execute in nested if statements

    Threaded Messages (3)

  2. hi check this[ Go to top ]

    hi keith
    well you have to use like this
    say if your user click radiobutton1 then you should write javascript and keep track of the radiobuttonclicked and use
    if you wanna to pass the param as a querystring in the URL
    ok i hope this helps you
    hey if you have any doubt you can write me to zeus2k at hotvoice dot com
    take care
  3. response.sendRedirect();[ Go to top ]

    hi keith,

    i think for ur problem, check out RequestDispatcher object . it has two methods include() and forward(). forward() is the right way to do what u wanna do. it is faster than sendRirect().


  4. response.sendRedirect();[ Go to top ]

    forward is faster than response.sendRedirect(), because
    it is on the server side. Also, the existing request
    object remains and is accessible on the new JSP.

    However, sendRedirect() is better when all of these
    are true:

    1) You want the user's browser location bar to reflect
    the second page
    2) You are finished with the first request object
    3) You don't mind the time delay while the user's browser
    makes that second request

    I've found #1 is important to two groups of people:
    1) QA engineers trying to figure out which page is having
    a problem
    2) Managers tracking web site usage statistics... the forwards tend to fool their tools as the "forwarded to"
    page may not show up.