This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Struts and the fly likes Adding parameters to ActionForward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Adding parameters to ActionForward" Watch "Adding parameters to ActionForward" New topic

Adding parameters to ActionForward

AnilPrakash Raju
Ranch Hand

Joined: Jul 26, 2004
Posts: 137

How can you add parameters to the path of actionForward?

eg. i want the jsp to go to (where the taskId can change)

in the path, i got:
i need to add "?taskid=1" to the path.
I tried actionforward.setPath("path")
but a get an error "Configuration is Frozen" Message

Any suggestions?


Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
You could try creating a new ActionForward using the existing ActionForward whose configuration is frozen, a clone so to say.

ActionForward modifiableActionForward = new ActionForward(existingActionForward);

Now you can modify the modifiableActionForward's path and return it from the method.

I have not tried this, but it should work. Not sure whether it is the right thing to do or if there is a better solution.

Please let us know, if this works or if you find something else that does.
Sheldon Fernandes
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
How would you do this inside a page? to make a series of links that are similiar each with a different parameter or querystring?

I agree. Here's the link:
subject: Adding parameters to ActionForward
Similar Threads
passing dynamic parameter in redirect
instantiate ActionForward objects
Regarding apply JOIN by using JPQL.
Different pages pointing to the Same Struts Action
POST parameter coming in null