Hello,

"G.L. Grobe" wrote:
> 
> I'm slowly integrating Velocity into my webwork pages, so know that I've got
> *lots* of files that are *.jsp's, and some that are *.vm's. But the
> questions themselves are more webwork related.

#snip()

> Q. #2
> ---
> I really like the webwork tables, and being new to velocity, is there a way
> to use both webwork tags and velocity within the same page. I hope not to
> have to rewrite the <webwork:table's as velocity templates.

You can incorporate Velocity syntax within a JSP page but the reverse is
not true.  Using "VelTag"
(http://jakarta.apache.org/velocity/veltag.html), a JSP taglib for
Velocity, you can embed Velocity syntax within a JSP page.  However, with
this solution there will be no $webwork object in the context and the
Velocity context will not search the ValueStack for you.  Other things
like the macros #action, #execute, #bean and #includeservet won't be
available either.  To get all this stuff to work would require reworking
much of the WebWorkVelocityServlet into a Bean that could be instantiated
with <jsp:useBean>.  Don't know how easy or difficult this would be.

If all you want to do is incorporate a table within a Velocity template
maybe the #includeservlet macro could be used to call a JSP template that
just has the table tags.

Since a lot of the table usage is configuring the renderers via
<webwork:bean>, you could do that in Velocity instead with the #bean
macro.  However, a Bean instantiated with the #bean macro doesn't save its
"id" in the same manner as the <webwork:bean> tag does.  As a result, the
JSP tags won't be able to see Velocity created Beans unless you push the
Bean onto the ValueStack and store an id for it by calling
$req.setAttribute("beanid", $bean).  Then, #includeservlet could be called
to include a JSP template with just the <webwork:table> tag.  Well, at
least theoretically ...

-Bill

_______________________________________________
Webwork-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webwork-user

Reply via email to