You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gregor Rayman <gr...@gmx.net> on 2001/07/31 19:03:50 UTC

Included Actions

Hi all,

is it somehow possible to include the output of an action in one JSP?

Now, when I try to include a *.do page, the server complains, it cannot
forward to the action's jsp (of course, since I don't want to forward,
I want to inlcude).

The only "solution" I've found, is to len the Action's perform method
return null and include the action (*.do) as well as the jsp. (Which
I really do not like, since then the including page plays the role of
the controller)

Where should I start if I wanted to change the Action servlet, to include
instead of forward?

(I include actions' output in my templates. Where one part is the content
and another part is the in an action generated menu)

--
gR



Re: Included Actions

Posted by Dan Connelly <ds...@adelphia.net>.
Gregor says:     Output of an "included action" in a JSP.  I think I understand this.

I do something like it for my "Struts Inside of Struts" project.  In doing so I am pushing the FormBean concept to its logical (and absurd) conclusion.

My FormBean contains only a StringBuffer attribute.  The View JSP for this is extirely empty (almost) except for the expression of the StringBuffer.

The function of my (outer) Action is to just invoke an HTTP session on an inner Action (a Struts Action in some other application on some other server), then to capture the HTML output of that HTTP session, to modify some of its critical tag attributes and, finally, to stuff that HTML character stream into the StringBuffer of the ActionForm.

I really thought that this would have horrible display latency before I tried it.   Not really.  Its almost bearable.  But don't try it 3 deep.  


Dan Connelly    (who is not Dan Connolly)



PS.  

By the way, Struts works nicely for this absurd usage.  I will still claim I honored MVC, although my View is vacuous and the Model knows damn well how it is to be rendered (almost).   One disappointment in all this is java.net.HTTPSession.  It doesn't deal cookies, so this implementation has problems for Session Tracking under Struts.   

I am not the only person displeased by java.net.HTTPSession.  There are alternative classes that produce can transfer cookie values (from Tigris, for example).  I just haven't tried any of them yet.     

N.B., however, with respect to Struts, that if my action form's (viewable) text is really huge, StringBuffer is not goint to work out.  Struts would have to be re-architected into producer-consumer threads for the Model logic and the View (rendering) logic, respectively.  This is an interesting thought.

  

----- Original Message ----- 
From: "Gregor Rayman" <gr...@gmx.net>
To: <st...@jakarta.apache.org>
Sent: Tuesday, July 31, 2001 1:03 PM
Subject: Included Actions


> Hi all,
> 
> is it somehow possible to include the output of an action in one JSP?
> 
> Now, when I try to include a *.do page, the server complains, it cannot
> forward to the action's jsp (of course, since I don't want to forward,
> I want to inlcude).
> 
> The only "solution" I've found, is to len the Action's perform method
> return null and include the action (*.do) as well as the jsp. (Which
> I really do not like, since then the including page plays the role of
> the controller)
> 
> Where should I start if I wanted to change the Action servlet, to include
> instead of forward?
> 
> (I include actions' output in my templates. Where one part is the content
> and another part is the in an action generated menu)
> 
> --
> gR
> 
>