aspose file tools*
The moose likes Struts and the fly likes Action forward to different box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action forward to different box" Watch "Action forward to different box" New topic
Author

Action forward to different box

Ed Thompson
Ranch Hand

Joined: Jan 20, 2006
Posts: 43
I know this question has been asked in similar formats elsewhere, but please be patient.

I have an action under SDtruts 1.1 at www.mydomain.com/appname/WSOD.do. The action mapping for this route url is:

<action path="/WSOD" forward="/1wsdweb/validate.aspx"></action>

1wsdweb is a different web app on a different box in the same domain. The above mapping does not work. Any guidance?

I want to forward, not redirect, as I want the cookies in the session to be included in the forward.

I keep going around in circles...
[ August 03, 2007: Message edited by: Ed Thompson ]

Even if the voices <i>aren't</i> real, they still have some good ideas!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Ed Thompson:
I want to forward, not redirect, as I want the cookies in the session to be included in the forward.

Sorry, Ed, what you're trying to do is simply not possible. You can redirect to another web application, but you cannot forward to it, even if it's on the same server. This is just one of the rules of Java EE Web Applications. If you want a Struts forward to redirect, that's pretty easy to set up. Here's an example:

I'm not sure what you're saying, though, about the cooikes. Cookies reside on the browser, not the server, and as long as the new server is in the same domain as the old server, the cookies will get picked up. However, there's no way the second application can share the same HTTPSession object as the first. If you have data you want to pass to the second application, I'd suggest passing it in query string parameters (e.g. ?parm1=foo&parm2=bar etc.).
[ August 03, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Ed Thompson
Ranch Hand

Joined: Jan 20, 2006
Posts: 43
Thanks Merrill.

Forget what I said about cookies, your right. I've just been spinning here trying to get this to work.

Correct me if I am wrong, but if I go with a redirect, the request makes another trip back to the browser before moving on? That is the trip I am trying to avoid.

Also, can I specify the redirect in the <action> tag? I don't want (need) to go to an Action class first for this one.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by Ed Thompson:
Correct me if I am wrong, but if I go with a redirect, the request makes another trip back to the browser before moving on? That is the trip I am trying to avoid.

You're right about the fact that a redirect makes another trip back to the browser. The only way to avoid the extra round trip to the browser is to call the URL directly from the action attribute of a <form> tag or link directly to it in a hyperlink <a> stanza.
Originally posted by Ed Thompson:

Also, can I specify the redirect in the <action> tag? I don't want (need) to go to an Action class first for this one.

No, there's no way to put the redirect in an action tag. If you want to use it in a form, don't use an <html:form> tag, but a regular <form> tag with the URL you want specifried as the action attribute.
[ August 03, 2007: Message edited by: Merrill Higginson ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action forward to different box