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 url with in the action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Redirect url with in the action class" Watch "Redirect url with in the action class" New topic

Redirect url with in the action class

meMalik Ahmed

Joined: Sep 29, 2010
Posts: 3
Dear friend i am new to struts2 me want to redirect my action with in the action class without using Struts.XML
let suppose my requested URL is
internally from action class without changing the URL in the browser. Like filter in Spring
sorry if me cant explain you clearly but if any one know please post some material
Srinivas Kollaparthi

Joined: Jan 19, 2008
Posts: 12
Lets us see if my understanding is correct.
your config xml looks like

Usually in your action class, you will return ActionForward object by calling mapping.findForward("success") to go to "/myindex.jsp"
If you want to redirect to some other page without specifying in config xml,
you will get actionforward object by instantiating it with your new path and return it.

meMalik Ahmed

Joined: Sep 29, 2010
Posts: 3
thanks brother for your reply..
but my question is little bit different..
actually me want to internally redirect my request to any action without feel changing my URL to user.
Let me explain more clearly
my requested URL is
me call this action then request will go in the myindex.action class
from that class me want to internally redirect to some other action class e.g
http://localhost:8080/my/home.action and do some process and takes value from that then com back to
means internally redirect
hope me define some more clear picture...
sorry if there is any confusion

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

You can use interceptors to perform task that you want .
In interceptor you can call any Action .

Good luck!!
A small leak can sink a Gigantic ship.>
meMalik Ahmed

Joined: Sep 29, 2010
Posts: 3
dear brother you suggested me to use interceptor.
now the problem i am facing is that me can only call interceptor before or after result..
how we can manually call a interceptor a specific point in the action..
let suppose me in the action class
public String execute()

4.(call interceptor)

in the method after execute me want to call interceptor and pass some parameters to interceptor...
and in the interceptor on behalf of the parameter i can do further processing then i can send any data(List) back to action..
thank in advance
and sorry if any confusion occur

I agree. Here's the link:
subject: Redirect url with in the action class
It's not a secret anymore!