Exforsys

Online Training

Struts Question: Redirecting to a URL

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


Go Back   Exforsys > Articles and Tutorials > Java Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-13-2004, 03:54 PM
akpraveen
 
Posts: n/a
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..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-13-2004, 06:10 PM
Senior Member
 
Join Date: Nov 2004
Posts: 132
Vasu
Re:Struts Question: Redirecting to a URL

Quote:
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.

Quote:
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-14-2004, 01:05 AM
akpraveen
 
Posts: n/a
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Kerberos FAQ, v2.0 (last modified 8/18/2000) Ken Hornstein Tech FAQ 0 10-19-2005 12:38 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 10-01-2004 06:00 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 07-03-2004 07:27 PM


All times are GMT -4. The time now is 08:49 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.