You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Richard Lamuette <tu...@laposte.net> on 2003/09/25 11:35:59 UTC

WW2 extension

I've been working on many projects using Struts/Velocity/Velocity Tools.
And I'd like to test the WebWork2 framework. Unfortunately, I think the
integration of velocity in the WW2 framework makes the use of velocity (as
template engine) not very easy. For instance, I cant use the Toolbox
Manager. So I'd like to know if it will be very difficult to use
ToolboxManager without VelocityViewServlet ?
Thank you.
Richard.


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: WW2 extension

Posted by Nathan Bubna <na...@esha.com>.
Richard Lamuette said:
> I've been working on many projects using Struts/Velocity/Velocity Tools.
> And I'd like to test the WebWork2 framework. Unfortunately, I think the
> integration of velocity in the WW2 framework makes the use of velocity (as
> template engine) not very easy. For instance, I cant use the Toolbox
> Manager. So I'd like to know if it will be very difficult to use
> ToolboxManager without VelocityViewServlet ?

hmm.  i don't know much about WebWork or WebWork2, so it's rather hard to say.
the ServletToolboxManager (or your own derivative of XMLToolboxManager) can be
used without the VVS, but whether it will work with WebWork2, i don't really
know.

i talked a bit about using VelocityTools without a servlet or without the VVS
here:
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg10616.html

the important thing for working with a ToolboxManager is being able to choose
the Context that is used.  you'll want to be using a ChainedContext.  you can
look at the source to that class and also the createContext(req,res) method of
the VelocityViewServlet.

a quick glance at WebWork's CVS makes me think that you'll need to be able to
extend the WebWorkVelocityServlet.  your subclass should create/initialize a
ServletToolboxManager (look at how the VVS does this) and override the
createContext() method to do something like this:

protected Context createContext(HttpServletRequest request,
                                HttpServletResponse response)
{
    Context subCtx = super.createContext(request, response);
    ChainedContext ctx =  new ChainedContext(subCtx, request, response,
getServletContext());
    if (toolboxManager != null)
    {
        ctx.setToolbox(toolboxManager.getToolboxContext(ctx));
    }
    return ctx;
}

hope that helps.

Nathan Bubna
nathan@esha.com


Re: WW2 extension

Posted by Nathan Bubna <na...@esha.com>.
Richard Lamuette said:
> I've been working on many projects using Struts/Velocity/Velocity Tools.
> And I'd like to test the WebWork2 framework. Unfortunately, I think the
> integration of velocity in the WW2 framework makes the use of velocity (as
> template engine) not very easy. For instance, I cant use the Toolbox
> Manager. So I'd like to know if it will be very difficult to use
> ToolboxManager without VelocityViewServlet ?

hmm.  i don't know much about WebWork or WebWork2, so it's rather hard to say.
the ServletToolboxManager (or your own derivative of XMLToolboxManager) can be
used without the VVS, but whether it will work with WebWork2, i don't really
know.

i talked a bit about using VelocityTools without a servlet or without the VVS
here:
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg10616.html

the important thing for working with a ToolboxManager is being able to choose
the Context that is used.  you'll want to be using a ChainedContext.  you can
look at the source to that class and also the createContext(req,res) method of
the VelocityViewServlet.

a quick glance at WebWork's CVS makes me think that you'll need to be able to
extend the WebWorkVelocityServlet.  your subclass should create/initialize a
ServletToolboxManager (look at how the VVS does this) and override the
createContext() method to do something like this:

protected Context createContext(HttpServletRequest request,
                                HttpServletResponse response)
{
    Context subCtx = super.createContext(request, response);
    ChainedContext ctx =  new ChainedContext(subCtx, request, response,
getServletContext());
    if (toolboxManager != null)
    {
        ctx.setToolbox(toolboxManager.getToolboxContext(ctx));
    }
    return ctx;
}

hope that helps.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org