it just seems like overkill. I don't see what is wrong with $inner_content.render().
john mcnally Daniel Rall wrote: > > John McNally <[EMAIL PROTECTED]> writes: > > > Daniel Rall wrote: > > > >> > >> A method which I've been tossing around to deal with this is to use a > >> ReferenceInsertionEventHandler: > >> > >> >http://jakarta.apache.org/velocity/developer-guide.html#EventCartridge%20and%20Event%20Handlers > >> > >> $inner_content has a handle to some sort of processing mechanism which > >> is triggered (tested for using instanceof) by the > >> ReferenceInsertionEventHandler configured for your EventCartridge. > >> The triggered code writes to the same output stream which the Writer > >> you passed to mergeTemplate() uses. > > > > Why can't $inner_content just render the template to the same stream as > > the outer_template is being written to. In this case > > $inner_content.toString() would just return null or "" and the template > > would be written to the stream when the toString() method was called. > > This is not a proper use of the toString() method, it would probably be > > better to have a better method name (e.g. render). In t3, there is a > > Renderer (DirectRenderer) that writes directly to the stream and it is > > used in layout templates to render navigations, screens, or portlets (or > > whatever else you want to call the inner templates). > > > > What does a ReferenceInsertionEventHandler add to this? What am I > > misunderstanding? > > ReferenceInsertionEventHandler allows you to have a render()-esque > method (which is called by your handler). toString() returns "", and > you escape the alluring trap of having toString() call render() > directly (which would be an improper overloading of the toString() > method, breaking the contract defined by java.lang.Object). > > Dan > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
