You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Michael Della Bitta <md...@earthlink.net> on 2004/01/27 20:40:36 UTC

VelocityServlet vs. VelocityViewServlet

Hi,

I'm used to subclassing VelocityServlet to create web applications. I'm 
beginning work on a new application, and I've heard that I should be 
switching to VelocityViewServlet. I was wondering if there's a rundown 
somewhere of the differences between the two or any gotchas that might 
arise.

Thanks,

Michael Della Bitta


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


Re: VelocityServlet vs. VelocityViewServlet

Posted by Michael Della Bitta <md...@columbia.edu>.
It's sounding though like even moving my existing stuff over to 
VelocityViewServlet won't be much of a hassle.

Thanks for the info, folks!

Michael

On Jan 29, 2004, at 7:22 AM, Geir Magnusson Jr wrote:

>
> On Jan 27, 2004, at 2:40 PM, Michael Della Bitta wrote:
>
>> Hi,
>>
>> I'm used to subclassing VelocityServlet to create web applications. 
>> I'm beginning work on a new application, and I've heard that I should 
>> be switching to VelocityViewServlet. I was wondering if there's a 
>> rundown somewhere of the differences between the two or any gotchas 
>> that might arise.
>>
>
> Here's a big gotcha : we've deprecated VelocityServlet in favor (or 
> 'favour' for some of you...) of VelocityViewServlet, as the purpose of 
> VS was simply to be a demo or base example of usage, and VVS is more 
> thoroughly supported as a living working core codebase, and represents 
> latest fashion in how Velocity is effectively used in web 
> applications....
>
> geir
>
>> Thanks,
>>
>> Michael Della Bitta
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
> -- 
> Geir Magnusson Jr                                   203-247-1713(m)
> geir@4quarters.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org


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


Re: VelocityServlet vs. VelocityViewServlet

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Jan 27, 2004, at 2:40 PM, Michael Della Bitta wrote:

> Hi,
>
> I'm used to subclassing VelocityServlet to create web applications. 
> I'm beginning work on a new application, and I've heard that I should 
> be switching to VelocityViewServlet. I was wondering if there's a 
> rundown somewhere of the differences between the two or any gotchas 
> that might arise.
>

Here's a big gotcha : we've deprecated VelocityServlet in favor (or 
'favour' for some of you...) of VelocityViewServlet, as the purpose of 
VS was simply to be a demo or base example of usage, and VVS is more 
thoroughly supported as a living working core codebase, and represents 
latest fashion in how Velocity is effectively used in web 
applications....

geir

> Thanks,
>
> Michael Della Bitta
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


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


Re: VelocityServlet vs. VelocityViewServlet

Posted by Nathan Bubna <na...@esha.com>.
Michael Della Bitta said:
> I'm used to subclassing VelocityServlet to create web applications. I'm
> beginning work on a new application, and I've heard that I should be
> switching to VelocityViewServlet. I was wondering if there's a rundown
> somewhere of the differences between the two or any gotchas that might
> arise.

we don't have a rundown of the differences anywhere i know of, but a quick
read of the javadoc for each might highlight a few things:

http://jakarta.apache.org/velocity/api/org/apache/velocity/servlet/VelocityServlet.html

http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/view/servlet/VelocityViewServlet.html

the most notable differences are the addition of toolbox support, the changed
keys for request/response, and the transparent access to
request/session/application attributes in your templates.

for more on the toolbox stuff (which is optional), see:
http://jakarta.apache.org/velocity/tools/view/

w.r.t. the request/response stuff, the VelocityServlet would automatically add
them to the context as $req and $res,  in the VVS, they are added under their
full names and are joined by the session (if one exists) and the servlet
context (i.e. $request, $response, $session, $application).  the attributes of
the request/session/application are also transparently accessable.  so, for
example:

$!request.setAttribute("foo", "bar") $foo

will render as " bar".

apart from these additions, there have also been numerous small bug fixes and
improvements made to the VVS that the now-deprecated VelocityServlet doesn't
have.

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