You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jimmy Lin <li...@corp.earthlink.net> on 2004/07/29 02:08:12 UTC
VelocityViewTool in a different web container
Hi,
I am building an web application using Velocity with the WebWorks Velocity
Servlet container. One of the requirements of our application isto be able
to run a query, display paginated results, and sort the results. I found
the AbstractSearchTool which appears to suits my needs.
How can I set up the VelocityViewTools so that it would work in a different
web container like WebWork?
Any help would be appreciated.
Thank you
Re: VelocityViewTool in a different web container
Posted by Nathan Bubna <na...@esha.com>.
Jimmy Lin said:
> I am building an web application using Velocity with the WebWorks Velocity
> Servlet container. One of the requirements of our application isto be able
> to run a query, display paginated results, and sort the results. I found
> the AbstractSearchTool which appears to suits my needs.
>
> How can I set up the VelocityViewTools so that it would work in a different
> web container like WebWork?
since i've never used WebWork, i'm not quite sure. but here's the gist:
you'll need to implement the setup(HttpServletRequest) and
executeQuery(Object) methods as usual. then just need to call the setup()
method for each request and put the tool into the context. (note that i'm not
sure how you set up your context using WebWork; you may have to extend their
servlet and override the createContext() method to do this.) this alone
should give you a functional search tool.
however, if you want to avoid re-calling executeQuery() for every page of the
same query, you will need to do one of two things:
either add this line to your setup(HttpServletRequest) method:
this.session = request.getSession();
or override both getStoredResults() and setStoredResults(StoredResults) to
temporarily store query results somewhere besides the session attributes.
to use other VelocityView tools with WebWork will be a little different (you'd
have to override init(Object), but the steps above are pretty much it for the
AbstractSearchTool.
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