aspose file tools*
The moose likes Struts and the fly likes redirect to an URL by POST. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "redirect to an URL by POST." Watch "redirect to an URL by POST." New topic
Author

redirect to an URL by POST.

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

hi all,

Want to redirect to another URL and having a single parameter using POST. how do i go about it....
'm using struts2 framework.

my URL is "http://server:port/apps/token=dufiidlcoodllsdkfficiidn"

also it would be really helpful if anybody gives me the action mapping in struts.xml, after i do the logic in an action class, how to redirect after POST.

Thanks in advance.
Pragna Mohapatra
Greenhorn

Joined: Dec 11, 2008
Posts: 5
Robin John wrote:hi all,

Want to redirect to another URL and having a single parameter using POST. how do i go about it....
'm using struts2 framework.

my URL is "http://server:port/apps/token=dufiidlcoodllsdkfficiidn"

also it would be really helpful if anybody gives me the action mapping in struts.xml, after i do the logic in an action class, how to redirect after POST.

Thanks in advance.



hi
try doing a find forward on the request
like request.findForwrd("ur defined path");
you can rediect the request to a different jsp.

and action mapping you can do in the following way

<!-- ========== Action Mapping Definitions ======== -->
<action-mappings>
<action
path="/login"
type="test.struts.LoginAction" >

<forward name="valid" path="/jsp/MainMenu.jsp" />
<forward name="invalid" path="/jsp/LoginView.jsp" />
</action>
</action-mappings>

you can go to the http://struts.apache.org/ following site ... it is very userfriedly and you will get lot of examples.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

@Pragna: Struts 2, not Struts 1.

The easiest way to do it is to include the parameter in your result configuration, similar to the following:



Your action would have a "token" property with a getter.

See result configuration and parameters in configuration results for more details.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

thanks david,

actually i have to redirect from one application to another and pass the token to the 2nd application, and i need to hide it from the URL, because when i used the action mapping it still comes in the URL but i dont want that. so how do i hide the token parameter from being visible in the URL.

regards.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

In general you don't--you're talking across separate applications, so you need to send all the information in the URL.
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Thanks David for clearing this out,

now i can reply the designers that we "CANT"

YiPEEEEEEE.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: redirect to an URL by POST.