URL after sendRedirect and forward

Hi,
          As I know, after execute response.sendRedirect("URL"),the URL in the
          browser will be changed.But in this case , it is still the original one.My
          server is NT4.0,Weblogic server 5.1 sp6,ie5
          step1:
          test.jsp
          <% response.sendRedirect("in1.jsp"); %>
          <jsp:forward page="in2.jsp" />
          the result URL is http://localhost:7001/MyApp/in1.jsp (Correct)
          step2: then change test.jsp to
          <jsp:forward page="in2.jsp" />
          <% response.sendRedirect("in1.jsp"); %>
          the result URL is http://localhost:7001/MyApp/test.jsp (Correct)
          step3: change test.jsp same as step1
          <% response.sendRedirect("in1.jsp"); %>
          <jsp:forward page="in2.jsp" />
          the result URL is http://localhost:7001/MyApp/test.jsp (incorrect)
          but the title of this page is http://localhost:7001/MyApp/in1.jsp - ...
          So, what's the matter with this one , is this a bug?
          Thank you for your attention.
          

As to which one is best, there are situations where both are useful.
A redirect has the disadvantage that it loses all request parameters/attributes (because it creates a new request)
The advantage to it is that if the user refreshes the screen (using F5, or pushing refresh button) it only refreshes the page that was redirected to.
If you do an internal forward,
You might find this article of use: http://www.theserverside.com/patterns/thread.tss?thread_id=20936

Similar Messages

  • SendRedirect anf forward method

    hi
    In which situtation we will use sendRedirect() and forward()...
    pls explain

    Doing a sendRedirect() means doing a round trip to the client and losing the state of the request Object. Doing a foward is more efficient since it doesn't involve a round trip to the client, and doing a forward maintains the state of the request Object. But you can only forward to certain resources (that are running on the same host, and usually in the same context due to security)

  • Differences between (response.sendRedirect and Requestdispatcher.forward)

    Hi All,
    I have 3 queries
    *1> I wanted to know the "Differences" between*
    response.sendRedirect and Requestdispatcher.forward
    *2> when do we Opt for response.sendRedirect?*
    *3> when do we Opt for Requestdispatcher.forward?*
    Thanks,
    Deepak AL

    The fundamental difference is that sendRedirect is a client based direction, while forward is a server based one.
    SendRedirect forces the client to make a new request. In effect you are telling the client browser "What you are looking for is over there"
    RequestDispatcher forward, is purely an internal server transition. The client knows nothing about the forward happening.
    Example
    Lets say you request the page www.myserver.com/myPage.jsp
    Example A: Redirect
    We send a redirect to www.myserver.com/thatPageOverThere.jsp
    The browser receives this message, and its address url changes to www.myserver.com/thatPageOverThere.jsp, and it sends a new request over there.
    Note that it is a completely new request, so any parameters that were sent with the old request are irrelevant. If you want to send them again you have to put them into the sendRedirect url.
    You can also send a redirect to www.myOtherServer.com/thatPageOnACompletelyDifferentServer.jsp
    Example B: Forward to thatPageOverThere.jsp
    We obtain a request dispatcher to "thatPageOverThere.jsp" and forward to that resource.
    The server instead of running myPage.jsp now executes and returns thatPageOverThere.jsp
    The client browser knows nothing of this. As far as it knows it asked for myPage.jsp, and it is getting that response back.
    So if you forward to something like "my/page/inASubFolder.jsp" you have to be very careful with relative links on the page.
    The browser requested myPage.jsp, so it will resolve relative links from that Url.
    When to use one or the other?
    Redirect would need to be used when the resource is on another server.
    Another common usage is the "Post-Redirect-Get" pattern. (you might want to look that up)
    Hope this helps you understand a little.
    cheers,
    evnafets

  • TS1424 Tried to use my apple id to update some apps and got"Connection Manager::invoke:: Failed to find service connection url"  After this occured a few times I reset the id password, and this was confirmed by email.  It still fails with same message.  I

    Tried to use my apple id to update some apps and got"Connection Manager::invoke:: Failed to find service connection url"  After this occured a few times I reset the id password, and this was confirmed by email.  It still fails with same message.  Ideas?

    Hi, you have to logout from your iTunes account and reconnect it:
    Settings / iTunes & App Stores / ...
    https://mobilfunkexperten.de/news/13450/sporadische-probleme-im-itunes-und-app-s tore
    Hope this helps... :-)

  • Is there a URL equivalent of backward and forward?

    I was wondering if there special URLs that are the equivalent to backward/forward. My backward and forward work fine and I know about Alt-LeftArrow and Alt-RightArrow.
    I am asking if there is something that can be typed into the URL bar that is the equivalent of these.

    In few words, "No." There is no such client for the Mac. The closest you may find would be to try the Mac MSN client, aMSN - VersionTracker or MacUpdate - but it's essentially just a messenger clone. I doubt it includes a Live Mail client.
    (Please don't suggest changing email accounts - I've asked this question elsewhere and that was the only response I got!)
    Because there is no other response.

  • My iPad 2 lost its mail after I upgraded to IOS8. It crashes every time I click on mail. Yet, I can send photos and forward things in outgoing mail.

    Lost my mail
    after I upgraded to IOS8. It crashes every time I click on mail. Yet, I can send photos and forward things in outgoing mail. how to restore?

    Answering my own question here. It's fixed! Another user recommended I switch to another wireless network then back to mine. And it worked! Mail is sending again with no problem.

  • I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    * In Firefox 3.6 and later on Windows you can hide the "Menu Bar" via "View > Toolbars" or via the right-click context menu on a toolbar.
    * Press F10 or press and hold the Alt key down to bring up the "Menu Bar" temporarily.
    * Go to "View > Toolbars" or right-click the "Menu Bar" or press Alt+V T to select which toolbars to show or hide (click on an entry to toggle the state).
    See also:
    * [[Menu bar is missing]]
    * http://kb.mozillazine.org/Toolbar_customization

  • Difference between jsp:forward sendRedirect and jsp include directive

    Am very much confused, please explain me the difference between
    jsp:forward sendRedirect and jsp include directive with a suitable example.
    I'll be very gratefull. Its very urgent.

    One basic difference. The include executes in the .jsp servelet created. The redirect transfers "control" by redirecting the client request to another destination. In other words, the current .jsp is no longer in charge or in the calling chain in any way.

  • Am running Firefox 8.0.1 on a MacBook Pro running OS 10.5.8. The URL bar at the top of the page has disappeared and is inaceesible along with the arrows for navigating backwatd and forward. Please help.

    Unable to scroll to top of page, as scroll tools are not active upon opening Firefox or a new browser window since this problem occurred. Home/startup page is set to Google Advanced Search. Would prefer not to have to re-install Firefox, if possible, as I have a lot of important data in Zotero and Bookmarks that I do not want to jeopardize.
    Thank you for your help.

    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    *Open the Customize window via "View > Toolbars > Customize"
    *Check that the "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    *If the "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the toolbar palette in the customize window to the Bookmarks Toolbar
    *If missing items are in the toolbar palette then drag them back from the Customize window on the toolbar
    *If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up
    *http://kb.mozillazine.org/Toolbar_customization
    *https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • The back and forward button stay disabled after upgrading to Firefox 4

    I upgraded to Firefox 4 and the back and forward buttons are never enabled. I see them, but they are not working.
    History works, recently closed pages work, bookmarks work.
    I disabled all addons, uninstalled FF4, deleted \Program Files\Firefox, re-installed, kept extensions disabled, removed all backups from bookmarkbackups, deleted places.sqlite and still nothing.
    What else can I do?

    Norton has a fix out. See: http://community.norton.com/t5/Norton-Internet-Security-Norton/Norton-Toolbar-5-5-incompatible-with-Firefox-4-RC1/td-p/411556/page/2

  • The browswer bar (for website url) and forward and backward arrows are not there on my firefox page and other webpages? What is the problem and how to resolve it, can anyone help?

    I am using desktop and Window XP.

    see [http://support.mozilla.org/en-US/kb/Back%20and%20forward%20or%20other%20toolbar%20items%20are%20missing Back and forward or other toolbar items are missing]
    [http://support.mozilla.org/en-US/kb/Back%20and%20forward%20or%20other%20toolbar%20items%20are%20missing#w_showing-the-navigation-toolbar Showing the Navigation Toolbar]
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • Lost the forward/back button after updating and the home button how do I get back?

    Firefox updated to 7 and I lost all of my add ons including the home button and the forward/back button. I was able to get all of my add ons restored except the home button and the forward/back buttons. How do I get them back? Wish now that I had not updated.

    Make sure that you do not run Firefox in Full Screen mode with all toolbars hidden.
    * Press F11 to toggle full screen mode (Firefox/File > Full Screen)
    If the menu bar is hidden then press the F10 key or hold down the Alt key, that should make the menu bar appear.
    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    * If items are missing then open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout" (Linux, Windows)
    * If a missing item is in the toolbar palette then drag it back from the Customize window on the toolbar
    * If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization
    * https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • OS X 10.7.3, Firefox 11, After doing everything FAQ area directs me to do still, I cannot access Back and Forward.

    The Back and Forward text exists next to the address bar, but I never get access to it, they are always gray. I never see a back or forward icon anywhere. I have tried restart Firefox in safe mode, restore default toolbar and anything else Firefox FAQ pages instructed. How can I navigate?

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.org/kb/Bookmarks+not+saved#w_fix-the-bookmarks-file
    You can also try to repair the places database with this extension:
    *https://addons.mozilla.org/firefox/addon/places-maintenance/

  • Url in sendRedirect

    Anyone please tell me if a make a call to sendRedirect with the url pattern like this /hello instead of
    absolute url www.myurl.com/hello
    will the redirection happen?

    <quote>
    sendRedirect
    public void sendRedirect(java.lang.String location)
    throws java.io.IOException
    Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.
    If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.
    Parameters:
    location - the redirect location URL
    Throws:
    java.io.IOException - If an input or output exception occurs
    IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL
    </quote>

  • Difference between sendRedirect and RequestDispatcher?

    Difference between sendRedirect and RequestDispatcher?

    I have a situation of needing to redirect a request to a URL that is outside of the container. The scenario is the following, we have a simple logging in servlet that takes some POST parameters (username, password, and other values.) Depending on the username and password, the logon request along with all its POST parameters need to be redirected integrally to another machine. How do i do a redirect with all my parameters intact? sendRedirect does not seem to have any (visible to me) mechanism to do this. We cannot send them on the URL as this will reveal things too easily to our users and we don't want them to bookmark the resulting page.
    Thanks for any help,
    t

Maybe you are looking for

  • ITunes cannot find find on NAS and marks them with "!" - Only double-click helps

    I have placed my iTunes library on my Synology NAS. After I (hopefully) got rif of my connection problems by switcvhing from afp to a nfs connection there is still another probem: iTunes does not "find" the songs on the NAS after have started it and

  • Camileo S10 - Arcsoft doesn't recognize any files on SD card & internal memory

    I have just bought a Camileo s10 camcoder. So far i was satisfied with the product till i connected it to my pc (vista fully compatible with recommendations). I installed the Arcsoft software but i never got any file imported because *the program rec

  • Errors 1335 and 2350

    I seem to have a similar problem installing the latest version of Adobe Reader 9.3 as others have had in the past with other Adobe products, but I'm not sure I understand either the cause or solution.  I previously had Adobe Reader 7 on my laptop and

  • HT5639 Switching from Parallels to Boot Camp

    How do I switch from Parallels to Bootcamp?  I have a 2011 MacBook Pro 17" with latest OS and running Windows 8 on Parallels.  I am unable to run SimCity (newest) on parallels, and read that it works on bootcamp.

  • Can someone tell me how to make this...

    I need to make a directory like this.. http://www.cereschamber.org/directory