You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Konstantin Priblouda <kp...@yahoo.com> on 2001/11/26 15:48:18 UTC
My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Hi all,
I was unable to participate in Velocity/Struts
diskussion for 72 hours due to unability of Deutsche
Telekom ( they can not fix DSL lines )
Here my EUR 0.02 to this topic.
Velocity has advantages over JSP. But to made it
usage,
it has to be as hassle-free as JSP is. So, here is my
proposal how to do it. I already started to hack on
such servlet.
1. Use extension mapping ( done )
2. Place template files the same way as every other
html or jsp or image into war
[advantages -> designer who knopw how to work with
jsp,
would not have any problems with developing ]
( done. It required to write simple resource
loader which does merely "getResourceAsStream()" off
Servlet context )
3. Made interesting abjects available in context
( request , response & session are already there )
I can also think of following objects:
- for URL rewriting
- skin management ( like in turbine, can be adapted
almost verbatim )
- a lot of other stuff
Such templating solution can be easily integrated with
struts (or whatever else which likes to use JSP)
4. Per-template initialisation code.
It can be class whose name is located based on
directory path fo template in question.
( say, for /foo/bar/blurge.vm class name would be:
<configured package prefix>.foo.bar.Blurge )
Default fallback classes would be also usefull.
They must be searched and executed in following order:
( if configured and existing )
DefaultContextPopulator,
<configured prefix>.ContextPopulator,
<configured prefix>.foo.ContextPopulator,
<configured prefix>.foo.bar.ContextPopulator
<configured prefix>.foo.bar.Blurge
(this is something like "autohandler"/"dhandler"
feature of HTML:Mason, which is very usefull)
5. Different tools can be configured like "tag
libraries"
( and their code/configuration stuff can be generated
with XDoclet )
I already started to hack on this, so anybody like to
join?
regards,
=====
Konstantin Priblouda ( ko5tik ) Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by Tim Colson <tc...@cisco.com>.
Rickard -
> Sorry for being annoying, but IMHO you would be wasting a serious amount
> of time, unless there is something fundamentally wrong with WebWork
Not annoying - but you must admit there is a lot of good support from folks
like Craig and Ted for Struts (and the 42 million folks who post daily to
the Struts-user mailing list <grin>).
And there are certainly some good ideas in there (you've borrowed a
few)...it's mostly the JSP stuff that makes my skin itch.
Therefore, I feel it is reasonable to 'supplement' Struts with Velocity.
:-)
BTW - I have looked at WebWork on a few occassions, and will continue to do
so as it matures. However, the RC3 status and scant documentation make it a
tough sell to my team for consideration.
> you want to do it over (which was the case when Jon told me "been there
> done that" when I wrote WebWork instead of using Turbine).
Hah hah...I recall those threads. :-) That reminds me, has Jon unsub'd from
the list? Or is he simply lurking and ultra-super-busy with Scarab?
Cheers,
Timo
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by Konstantin Priblouda <kp...@yahoo.com>.
>
> Having shown WebWork to my project managers: no I
> wouldn't be able to
> sell Struts to them either ;-)
gone to look at WebWork :)
regards,
=====
Konstantin Priblouda ( ko5tik ) Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by Rickard Öberg <ri...@xpedio.com>.
Konstantin Priblouda wrote:
>>Yes, loads. So, instead of putting them all in
>>there, why not make it
>>possible to define in the template what you need,
>>and just put *that*
>>there. WebWork allows this by adding a #bean macro
>>(to instantiate a
>>JavaBean) and a #action macro (to allow things that
>>can execute to be
>>accessed).
>>
>
> Even read YMTD? Ugly, scary and sort of thing
> velocity is trying to avoid :)
What does the YMTD doc (which I have read) have to do with the above?
> What I like to achive is, good separation between
> java code ( to populate context ) and template
> ( say, between me, hacker, and those sleek types
> who are called wob designers and know nothing :) )
Agree.
> I also like it to be completely framework unaware:
> We speking just templating here. We do not know ( or
> bother ) about actions.
Sure. That's ok. Just don't use the #bean or #action macros and you'll
be fine.
> We have just a wiew ( velocity template ) and
> class[es] ( mapped as impicitly as possible ) which
> populates context for it
And WebWork allows just that. Make an action, have a bunch of
get-methods, done.
> To make velocity an JSP killer we need to made it
> usage as hassle-free as possible, and mapping actions
> to templates ( even if there is no action at all,
> like displaying list of some EJB's )
Displaying a list of EJB's *is* an action. Some actions are read/write,
and some are read-only. An action is simply a piece of code that gets
executed with a given set of parameters.
> requires some
> doctoring on conguguration files.
Yes, and both your code and templates will be much better off because of it.
> Template/Implicitely mapped class has advatage of
> clear separation between persentation code and data
> pulling logic ( and designers can not tweak in
> scriptlets... )
Again, this is what you get in WebWork.
> What I like to achieve is framework-blind templating
> with all the nice features from different templating
> systems ( velocity for templating, HTML:Mason
> for implicitly mapped code etc. )
With WebWork your templates can be as framework agnostic as you want
them to be. The additional WebWork macros can be ignored, and getting
things from the contetx is "business as usual" from a template point of
view.
>>http://sourceforge.net/projects/webwork
>>
>
> I already looked at WebWork, and considered it worth
> investigating. But my current "money generating"
> work requires templating, struts is OK as framework
> ( except of JSP's ).
Struts may be ok, but WebWork is great :-) Besides, this whole thread
started as a way to get the Struts framework to work nicely with
Velocity, and I simply stated that all of the things you want to do
(AFAICT) can already be done much much simpler with WebWork+Velocity.
> And most important is that I can
> sell sacking JSP to my project manager ( due lack of
> performance of my co-developers ), but not struts :)
Having shown WebWork to my project managers: no I wouldn't be able to
sell Struts to them either ;-)
/Rickard
--
Rickard Öberg
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by Konstantin Priblouda <kp...@yahoo.com>.
> Yes, loads. So, instead of putting them all in
> there, why not make it
> possible to define in the template what you need,
> and just put *that*
> there. WebWork allows this by adding a #bean macro
> (to instantiate a
> JavaBean) and a #action macro (to allow things that
> can execute to be
> accessed).
Even read YMTD? Ugly, scary and sort of thing
velocity is trying to avoid :)
> WebWork has a way to map actions to views. Example
> properties config file:
> # Define action alias (used in URL)
> myaction.action=myapp.MyAction
> # Define input view (form)
> myaction.input=myactioninput.xslt
> #Define success and error views
> myaction.success=myaction.vm
> myaction.error=myactionerror.jsp
>
> With failovers and shortcuts possible both on action
> aliases and view
> page/template. (i.e. you can define a global error
> page)
What I like to achive is, good separation between
java code ( to populate context ) and template
( say, between me, hacker, and those sleek types
who are called wob designers and know nothing :) )
I also like it to be completely framework unaware:
We speking just templating here. We do not know ( or
bother ) about actions.
We have just a wiew ( velocity template ) and
class[es] ( mapped as impicitly as possible ) which
populates context for it
To make velocity an JSP killer we need to made it
usage as hassle-free as possible, and mapping actions
to templates ( even if there is no action at all,
like displaying list of some EJB's ) requires some
doctoring on conguguration files.
Template/Implicitely mapped class has advatage of
clear separation between persentation code and data
pulling logic ( and designers can not tweak in
scriptlets... )
What I like to achieve is framework-blind templating
with all the nice features from different templating
systems ( velocity for templating, HTML:Mason
for implicitly mapped code etc. )
> http://sourceforge.net/projects/webwork
I already looked at WebWork, and considered it worth
investigating. But my current "money generating"
work requires templating, struts is OK as framework
( except of JSP's ). And most important is that I can
sell sacking JSP to my project manager ( due lack of
performance of my co-developers ), but not struts :)
regards,
=====
Konstantin Priblouda ( ko5tik ) Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by Rickard Öberg <ri...@xpedio.com>.
Konstantin Priblouda wrote:
> 1. Use extension mapping ( done )
Done in WebWork too.
> 2. Place template files the same way as every other
> html or jsp or image into war
> [advantages -> designer who knopw how to work with
> jsp,
> would not have any problems with developing ]
> ( done. It required to write simple resource
> loader which does merely "getResourceAsStream()" off
> Servlet context )
Done in WebWork too.
> 3. Made interesting abjects available in context
> ( request , response & session are already there )
Done in WebWork too, although only application objects get placed there
(which most of the time wrap request, response and session objects).
E.g. request parameter "foo"="bar"
-> action.setFoo("bar")
-> action is put in context
-> $foo is valid in code (which will invoke action.getFoo())
This way it is clear from looking at code what parameters you have
available, instead of having to look at what input fields the page
calling you included.
> I can also think of following objects:
> - for URL rewriting
> - skin management ( like in turbine, can be adapted
> almost verbatim )
> - a lot of other stuff
Yes, loads. So, instead of putting them all in there, why not make it
possible to define in the template what you need, and just put *that*
there. WebWork allows this by adding a #bean macro (to instantiate a
JavaBean) and a #action macro (to allow things that can execute to be
accessed).
> Such templating solution can be easily integrated with
> struts (or whatever else which likes to use JSP)
Yes yes yes... been there, done that :-)
> 4. Per-template initialisation code.
> It can be class whose name is located based on
> directory path fo template in question.
> ( say, for /foo/bar/blurge.vm class name would be:
> <configured package prefix>.foo.bar.Blurge )
> Default fallback classes would be also usefull.
> They must be searched and executed in following order:
> ( if configured and existing )
> DefaultContextPopulator,
> <configured prefix>.ContextPopulator,
> <configured prefix>.foo.ContextPopulator,
> <configured prefix>.foo.bar.ContextPopulator
> <configured prefix>.foo.bar.Blurge
>
> (this is something like "autohandler"/"dhandler"
> feature of HTML:Mason, which is very usefull)
WebWork has a way to map actions to views. Example properties config file:
# Define action alias (used in URL)
myaction.action=myapp.MyAction
# Define input view (form)
myaction.input=myactioninput.xslt
#Define success and error views
myaction.success=myaction.vm
myaction.error=myactionerror.jsp
With failovers and shortcuts possible both on action aliases and view
page/template. (i.e. you can define a global error page)
> 5. Different tools can be configured like "tag
> libraries"
> ( and their code/configuration stuff can be generated
> with XDoclet )
WebWork is already integrated with XDoclet, so you can write your code
with XDoclet tags and have the configuration files, containing action
aliases and view mappings, generated as part of your build process.
> I already started to hack on this, so anybody like to
> join?
http://sourceforge.net/projects/webwork
Sorry for being annoying, but IMHO you would be wasting a serious amount
of time, unless there is something fundamentally wrong with WebWork and
you want to do it over (which was the case when Jon told me "been there
done that" when I wrote WebWork instead of using Turbine).
/Rickard
--
Rickard Öberg
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My $0.02 to Velocity usage (was: Velocity & Struts - redux )
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/26/01 9:48 AM, "Konstantin Priblouda" <kp...@yahoo.com> wrote:
> Hi all,
> I was unable to participate in Velocity/Struts
> diskussion for 72 hours due to unability of Deutsche
> Telekom ( they can not fix DSL lines )
>
> Here my EUR 0.02 to this topic.
Which isn't == USD0.02 :)
>
> Velocity has advantages over JSP. But to made it
> usage,
> it has to be as hassle-free as JSP is. So, here is my
> proposal how to do it. I already started to hack on
> such servlet.
I think that it's a fair to start thinking this way, but JSP and Velocity
aren't quite comparable, as you can use velocity an all sorts of places that
you can't use JSP - i.e. JSP is something that is tied very heavily to
servlets.
Now, given that is being overly pendantic, I do agree with you - however,
what you list below is what every framework attempts to provide in some way
or another...
>
> 1. Use extension mapping ( done )
> 2. Place template files the same way as every other
> html or jsp or image into war
> [advantages -> designer who knopw how to work with
> jsp,
> would not have any problems with developing ]
> ( done. It required to write simple resource
> loader which does merely "getResourceAsStream()" off
> Servlet context )
>
> 3. Made interesting abjects available in context
> ( request , response & session are already there )
>
> I can also think of following objects:
> - for URL rewriting
> - skin management ( like in turbine, can be adapted
> almost verbatim )
> - a lot of other stuff
>
> Such templating solution can be easily integrated with
> struts (or whatever else which likes to use JSP)
>
> 4. Per-template initialisation code.
> It can be class whose name is located based on
> directory path fo template in question.
> ( say, for /foo/bar/blurge.vm class name would be:
> <configured package prefix>.foo.bar.Blurge )
> Default fallback classes would be also usefull.
> They must be searched and executed in following order:
> ( if configured and existing )
> DefaultContextPopulator,
> <configured prefix>.ContextPopulator,
> <configured prefix>.foo.ContextPopulator,
> <configured prefix>.foo.bar.ContextPopulator
> <configured prefix>.foo.bar.Blurge
>
> (this is something like "autohandler"/"dhandler"
> feature of HTML:Mason, which is very usefull)
>
> 5. Different tools can be configured like "tag
> libraries"
> ( and their code/configuration stuff can be generated
> with XDoclet )
>
> I already started to hack on this, so anybody like to
> join?
>
I know Rickard talked with you about WebWork, but also look at the
'PumpServlet' (see the powered-by page) as well as the other frameworks on
that page...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>