aspose file tools*
The moose likes Struts and the fly likes Probably it's just a simple question (ActionForward?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Probably it Watch "Probably it New topic
Author

Probably it's just a simple question (ActionForward?)

Olexiy Prokhorenko
Ranch Hand

Joined: Jul 11, 2004
Posts: 97
Hello guys,

Please help me a bit.

I need to do the following.

There are a bunch of my Action's (*.do).
They can be called from HTML FORM's, or just via simple href="..." links.

In all of these Action's, they will do some calculations/checkings, and in some cases will redirect to
mapping.findForward("specialaction")
this "specialaction" will do it's own job, but AFTER that it will need to return to Action which called it, but exactly the way how this previous Action was called (if via HTML FORM - with all data, etc.)


How can I do that?

Thank you!


<a href="http://www.BossTalks.com" target="_blank" rel="nofollow">http://www.BossTalks.com</a><br />Free advices and help for entrepreneurs: from Idea to IPO<br />Software and IT Project Management forum
Mark Hartnett
Greenhorn

Joined: Mar 01, 2005
Posts: 4
My advice is to not forward to another action object. Just use a basic java class, instanciate it in any action object you need to and use its functions.

You could make the object a singleton so that it is instanciated only once and becomes available for any action object that needs it.


This would eliminate the need to do multiple forwards and allow you to do all your processing in a single action class.
[ March 01, 2005: Message edited by: Mark Hartnett ]
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
ALong with what Mark said, check out the following thread:

http://www.coderanch.com/t/50284/Struts/Struts-Recipes-Action-chaining-recipe
Olexiy Prokhorenko
Ranch Hand

Joined: Jul 11, 2004
Posts: 97
Unfortunatelly, I cannot instantiate a class.
This separated Action form can do numerous operations, even presenting few HTML FORMs, and processing their input... and only after that - return to Action which initially called it.

So, it's not an option. Not in my case.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Probably it's just a simple question (ActionForward?)