Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Struts Question: Redirecting to a URL

This is a discussion on Struts Question: Redirecting to a URL within the Java forums, part of the Programming Talk category; I am trying to use the mapping.findforward() method to redirect the control to a URL like http://www.yahoo.com I declared a ...

  1. #1
    akpraveen Guest

    Struts Question: Redirecting to a URL

    I am trying to use the
    mapping.findforward() method to redirect the control to a URL like http://www.yahoo.com

    I declared a action forward tag in struts-config.xml but for some reason, when I use the execute method (Struts 1.1) it doesn\'t work. When I use the perform method (Struts 1.0), it works!

    Is there a way to make this work? All i want to know is whether I can turn-off \"ContextRelative\" field (Its inherited from Class ForwardConfig from which ActionForward is derived!

    Preferred behavior is -> As soon as a user enters, via a link, he/she is sent to a Servlet (Having just one Action Class called callingServlet.java). The action class basically looks for the user id in session and if it is not available, redirects control to another page outside (say http://www.yahoo.com/findme.jsp?retu...lingServlet.do)

    This works fine if findme.jsp is within the WebApp context. But it doesn\'t work when I try to redirect to www.yahoo.com.

    I am using WSAD 5.0. Also, is there a way to update the Struts plugin on WSAD to nightly build release of Struts from Apache?

    AND NICE JOB by ExForsys for making the Books available. Helped me a lot!

    Thanks..


  2. #2
    Vasu is offline Member Array
    Join Date
    Nov 2004
    Answers
    36

    Re:Struts Question: Redirecting to a URL

    I am trying to use the mapping.findforward() method to redirect the control to a URL like http://www.yahoo.com I declared a action forward tag in struts-config.xml but for some reason, when I use the execute method (Struts 1.1) it doesn\'t work. When I use the perform method (Struts 1.0), it works!
    Answer:
    Check your struts version in WSAD. I guess it is 1.0, so execute() method is not working. So change to version Struts 1.1 and try.

    I am using WSAD 5.0. Also, is there a way to update the Struts plugin on WSAD to nightly build release of Struts from Apache?
    Answer:
    In the Project Navigator of WSAD, select a (web) project name, right-click the name, and click Properties. On the Properties page, click Web Project Features, check the Add Struts support box, and click Apply. If you want to override the default Struts settings, on the Struts Settings page click the Override default settings box. To specify a different version, select from the \"Struts version\" drop-down menu. This determines which .jar and .tld files will be copied to the workspace: those for Struts 1.1 (default) or those for Struts 1.0.2. Click Finish. Note: Whatever version of Struts you select for your project becomes the default for your subsequent Struts projects.


  3. #3
    akpraveen Guest

    Re:Struts Question: Redirecting to a URL

    It still doesn\'t work!

    I was able to change the Struts Version!

    But one thing I know for sure is that the

    perform() method is able to redirect a forward with a full qualified URL path like http://www.yahoo.ciom

    whereas the execute() does not!

    I don\'t know why! There were others who asked the same question, but did not reply, so for now I am stuck with this problem or I have to use logic/jsp tags.



    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...