The Velocity Tools are a neat way to implement helpers.

* http://jakarta.apache.org/velocity/tools/index.html

Velocity Struts is an extension of the Velocity Tools that implements
the Struts API as set of helper objects that are injected into the
server page context. Very cool.

It's not on the roadmap, but something that was in the Jericho
whiteboard was the idea of being able to define arbitrary POJO objects
that would be automatically injected to one of the scopes, either for
some requests for all requests, so that they would seem to be
"implicit" to the page (like the Velocity Tools).

I doubt that it would be difficult to use a custom tag or JSTL
expression to fire a helper as the page was rendering. A kink with
this strategy is the inverse of your forwarding issue. If something
goes wrong while the page is rendering, it's too late to dispatch to
another page.

-Ted.

On 10/13/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
> I came across a discussion about view helpers, started by Tim Fennel,
> author of Stripes. He advocates the "inverted" model for displaying
> views, when view helper action is called from JSP if needed, instead
> of forwarding to JSP page from action, like it works in Struts now.
>
> With his approach, it is possible to navigate directly to JSP. On the
> one hand, this is a step backward, since I used to consider a JSP page
> as a mere view, and I prefer to navigate to web resource instead of
> navigating to a concrete view.
>
> On the other hand, using JSP directly from browser allows to employ
> <jsp:include> without forwarding. Currently I create embedded JSP
> controls by including Struts action into a JSP page. The action
> forwards to JSP file to render a fragment. Servlet engines do not like
> forwarding, and closes output stream immediately after returning from
> forwarded fragment, so the rest of the parent page is not rendered.
>
> Using JSP directly solves the problem, because no forwarding needed.
>
> What about creating a tag that will allow to define a certain bean as
> a view helper, and to automatically call something like processView()
> on it, and return a string mapping, which could be used to select a
> subview. Several subviews can be defined on one JSP page, and be
> selected via tag or a scriptlet.
>
> Michael J.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
HTH, Ted.
http://www.husted.com/poe/

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

Reply via email to