Disclaimer : I am not a Turbiner.
Sky Torch wrote:
>
> All,
>
> pls shed some light if you disagree with the followings.
>
> my impression is JSP and Velocity have different merits.
>
> 1. state info
>
> JSP provides complicated stateful-capable mechanism via
> its object scopes. object can be shared at different
> context level from page, request, session to application.
>
> velocity has only request level context level. in fact,
> one request askes for one screen, it's page level context.
> info can't be shared at session and app level.
This is somewhat misleading, isn't it? Isn't JSP is a thin layer on top
of the Servlet's three scopes, all three of which are available to
Velocity.
However, I will note that I personally find the three scopes confusing :
this is an issue that should be managed by the controlling servlet /
data model, rather than relying on the default structure of the servlet
container / request environment. Just my opinion.
> 2. runtime behavior
>
> JSP has runtime dispatching mechanism vis forward, param,
> etc directives. velocity has to initiate different
> requests for different pages.
JSP and Velocity aren't quite comparable if you take the 'just JSP'
approach, as Velocity requires a controller servlet. After all,
Velocity is just a template engine :)
However, with the conventional Model2 approach for JSP development, I
think they are comparable, and all features such as forward,
parameterization etc are available.
There are some tremendous advantages to using Velocity in this way - for
example, error handling is reasonably well done - the rendering process
completes before the servlet 'releases control' back to the container,
so you can attempt to correct and retry, or just direct to an error
page. Further, you can handle any problems that occurr in your 'beans'
as well in a fine-grained way, allowing the rendering process to
continue if you wish.
> 3. type safe
>
> neither can do compile time checking. need to wait
> until runtime error thrown to find out something is
> wrong.
Yes, as far as syntax goes. In Velocity, the event handling will allow
you to handle some basic problems, like incorrect references or
exceptions thrown by your 'beans'.
> 4. simplicity
>
> velocity has simpler syntax, thus less error-prone.
> jsp can be simplified by taglib and javabeans.
Well, the beans are a wash - Velocity will allow you to use the same
beans, and I think is more flexible as you can actually access any
methods you wish :
$foo.getMyObject().callThisMethod("green").returnElement( $which )
Try that in JSP w/o <% and %> :)
> 5. MVC
>
> in jsp, request->servlet(C)->.(M).->jsp(V)
> in velocity, request->servlet(C)->template(V)->screen
> class(M)
>
> either way is fine.
>
> 6. job oppotunity
>
> jsp has bigger market. :-)
>
Sure.
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]