It seems to me that you should consider refactoring your actions.

I would make a separate class that Action B delegates to in order
to create the JPG data. Then Action A can use this other object
without any problem. If there is shared state between the two, and
you need to have the same instance of the third object for some
reason, then that's a different type of problem to solve.

If there is NO state shared, then this is an easy problem. Just
create a class ImageGenerator that has a method or methods that
produce the data for your image, and call it from Action A and
Action B as needed.

In general, I try to keep my actions as simple as possible, and
delegate to other classes/objects for any "real" functionality.
If your actions become too dependent on each other, then if you
decide to change the way your application flow works, you'll end
up rewriting a lot more code than if you keep the actions simple
and atomic (as much as is reasonable).

If this doesn't cover your problem well enough, give us some
more details and we'll work from there.

Mike


> -----Original Message-----
> From: Ide Mile [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 31, 2005 8:58 AM
> To: user@struts.apache.org
> Subject: Problem with including content from another action
> 
> 
> Suppose I have two actions: Action_A and Action_B.
> Action_B only generates raw data for an jpg image.
> From my Action_A I have to call Action_B several times, and 
> just pick up the bytes needed to construct images.
> The problem lies in the fact that from Action_A I can't call 
> Action_B directly, because that way the ActionForm is created 
> every time I call Action_B.
> It happens always despite the fact that both actions are 
> belonging to the same session (scope="session" in action mappings).
> Maintaining of the ActionForm when calling Action_B is a must.
> 
> So, how do I read output from the Action_B inside Action_A?
> I think IncludeAction might be a solution, but I don't know 
> how to implement it, i.e. I don't know how to use it inside 
> servlet (Action_A).
> Any sample or advice?
> 
>               
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Mail - Helps protect you from nasty viruses.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to