File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Redirect and RedirectAction result types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Redirect and RedirectAction result types" Watch "Redirect and RedirectAction result types" New topic

Redirect and RedirectAction result types

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


What woule be the difference between these two Action types? Both seem to have the same purpose. I mean I can very well use the Redirect result type to redirect to an Action class. Why do I explicitly need a RedirectAction result type?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
David Newton

Joined: Sep 29, 2008
Posts: 12617

You *could* redirect to an action, but then you have to specify the full URL of the action including the extension rather than simply specifying the action name (and optionally its namespace).

"redirectaction" works with the framework, "redirect" is a standard servlet spec redirect that ignores the framework.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032

Good! Thanks!
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489


i have a little problem to redirect any action...

example :
now iam in URL : http://localhost:8080/MyApplication/Admin/Tasks/new.action
how to i redirect to URL : http://localhost:8080/MyApplication/Admin/Example/show.action

now i use 2 process "GET" for go to http://localhost:8080/MyApplication/Admin/Example/show.action

first process go to URL : http://localhost:8080/MyApplication/Admin/Tasks/Just.action
which result to Velocity which embed :
<meta HTTP-EQUIV="REFRESH" content="0; url=http://localhost:8080/MyApplication/Admin/Example/show.action">

is it a good idea?..


(Sorry my english isn't too good)

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
I agree. Here's the link:
subject: Redirect and RedirectAction result types
It's not a secret anymore!