You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by m_kk <ki...@yahoo.com> on 2008/09/10 20:05:37 UTC

Velocity reference

Hi,
Can any one direct me to velocity-struts tutorials or any document
describing velocity tags and elements?. 

Thanks  in advance
-- 
View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Velocity reference

Posted by Nathan Bubna <nb...@gmail.com>.
Oh, i should add that the VelocityStruts examples that i pointed you
toward originally are for using Velocity in front of Struts 1.   The
Struts people completely changed their framework for Struts 2 by just
adopting WebWork 2.2 as Struts 2.  So anything you find for Struts 1
will not work for Struts 2 and vice versa.

On Fri, Sep 12, 2008 at 7:37 AM, Nathan Bubna <nb...@gmail.com> wrote:
> On Fri, Sep 12, 2008 at 7:15 AM, m_kk <ki...@yahoo.com> wrote:
>>
>> Thanks for the resource. Unfortunately none of the examples use velocity
>> tags. Its quite awkward  not to find  proper resource and also don't
>> understand the need of velocity when there is struts tags already.
>
> there is only one velocity "tag" these days
> (http://velocity.apache.org/tools/devel/view.tag.html).  and i don't
> think it's what you are talking about.  it will stay awkward for you,
> so long as you don't have your terms right, because you won't be able
> to find the right documentation.
>
>> The main question which is unanswered is why does velocity introduce its own
>> <tr> and <td> tags for #slabel,#ssubmit etc.
>
> Velocity doesn't do that.  However, i believe Struts 2/WebWork does
> introduce things like that.  You should probably be asking them about
> it. (user@struts.apache.org)
>
>>  I want to have a table with 3
>> columns first with a html label, second with a submit button and third to
>> display the result.  Clearly velocity is limited to basic design and i feel
>> not worth for designing a good web application.
>
> I would argue that not much about this is quite clear to you yet. :)
> Still, if you are using Struts 2, i know they do support other options
> for templating.  Perhaps you will find something else to be better
> documented.  But really, i would ask on that list first, since it
> appears that your questions involve their custom Velocity directives,
> rather than the core Velocity functionality.
>
>>
>>
>>
>> Nathan Bubna wrote:
>> >
>> > http://velocity.apache.org/tools/releases/1.4/struts/
>> >
>> > The VelocityTools binary distribution also comes with a VelocityStruts
>> > example application that is quite instructive.  I'd recommend
>> > downloading that and dropping the struts.war file in your favorite
>> > servlet engine and playing around with it.  The source code for that
>> > example is also quite handy, if you download the VelocityTools source
>> > distribution.
>> >
>> > On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
>> >>
>> >> Hi,
>> >> Can any one direct me to velocity-struts tutorials or any document
>> >> describing velocity tags and elements?.
>> >>
>> >> Thanks  in advance
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
>> >> Sent from the Velocity - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> >> For additional commands, e-mail: user-help@velocity.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> > For additional commands, e-mail: user-help@velocity.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19456786.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>

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


Re: Velocity reference

Posted by m_kk <ki...@yahoo.com>.
This info is quite helpful. Thanks a lot

Christopher Schultz-2 wrote:
> 
> To whom it may concer,
> 
> m_kk wrote:
>> wooow velocity core is different from velocity struts.
> 
> Well, not really. Everything is the same, except that the Struts folks
> have introduced a rich set of macros that support their framework.
> 
> If you want a table in Velocity, you don't have to use any special tags
> or whatever: just write the HTML as you usually would. The same is true
> for any other HTML tag (or whatever output you are trying to generate).
> 
> The Struts "tags" (named so because they support JSP and Freemarker,
> both of which use more tag-oriented syntax) should be the same no matter
> which templating language you use (JSP, Freemarker, or Velocity). The
> Velocity syntax is simply a bit different because of the way that
> Velocity does things (i.e. it is /not/ tag-oriented, but rather
> macro-oriented).
> 
> I think this page (and friends) would be helpful to you:
> http://struts.apache.org/2.0.11.2/docs/tag-syntax.html
> 
> Specifically, read this page and continue until you get to the
> Velocity-related stuff. You may be uninterested in the JSP/Freemarker
> coverage, but it's worth reading to understand how similar the tags are
> (and how to read the official documentation, which always uses JSP
> syntax for examples). You also might be swayed into using JSP or
> Freemarker if you like their style better.
> 
> The real meat start here:
> http://struts.apache.org/2.0.11.2/docs/velocity.html
> 
> Finally, the insertion of the "extra" <td> elements is from the Struts
> macros -- not Velocity. You want to read more about the "look and feel"
> (or whatever they call it... it's been a while since I reviewed Struts 2
> in Action) options... forms, specifically, have a look and feel applied
> to them so that you don't have to add all those tags yourself. Your
> templates will be a lot cleaner, and you can more easily switch between
> looks-and-feels rather than doing massive search-and-replace.
> 
> Hope that helps,
> -chris
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19461358.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Velocity reference

Posted by Christopher Schultz <ch...@christopherschultz.net>.
To whom it may concer,

m_kk wrote:
> wooow velocity core is different from velocity struts.

Well, not really. Everything is the same, except that the Struts folks
have introduced a rich set of macros that support their framework.

If you want a table in Velocity, you don't have to use any special tags
or whatever: just write the HTML as you usually would. The same is true
for any other HTML tag (or whatever output you are trying to generate).

The Struts "tags" (named so because they support JSP and Freemarker,
both of which use more tag-oriented syntax) should be the same no matter
which templating language you use (JSP, Freemarker, or Velocity). The
Velocity syntax is simply a bit different because of the way that
Velocity does things (i.e. it is /not/ tag-oriented, but rather
macro-oriented).

I think this page (and friends) would be helpful to you:
http://struts.apache.org/2.0.11.2/docs/tag-syntax.html

Specifically, read this page and continue until you get to the
Velocity-related stuff. You may be uninterested in the JSP/Freemarker
coverage, but it's worth reading to understand how similar the tags are
(and how to read the official documentation, which always uses JSP
syntax for examples). You also might be swayed into using JSP or
Freemarker if you like their style better.

The real meat start here:
http://struts.apache.org/2.0.11.2/docs/velocity.html

Finally, the insertion of the "extra" <td> elements is from the Struts
macros -- not Velocity. You want to read more about the "look and feel"
(or whatever they call it... it's been a while since I reviewed Struts 2
in Action) options... forms, specifically, have a look and feel applied
to them so that you don't have to add all those tags yourself. Your
templates will be a lot cleaner, and you can more easily switch between
looks-and-feels rather than doing massive search-and-replace.

Hope that helps,
-chris


Re: Velocity reference

Posted by m_kk <ki...@yahoo.com>.
wooow velocity core is different from velocity struts. I wounder where in the
world would have found that :thinking:. I am back to square one.  I guess i
would have to take this to struts mail listing. Thanks for the info. I would
have wasted few more weeks for no reason otherwise. 

Nathan Bubna wrote:
> 
> On Fri, Sep 12, 2008 at 7:15 AM, m_kk <ki...@yahoo.com> wrote:
>>
>> Thanks for the resource. Unfortunately none of the examples use velocity
>> tags. Its quite awkward  not to find  proper resource and also don't
>> understand the need of velocity when there is struts tags already.
> 
> there is only one velocity "tag" these days
> (http://velocity.apache.org/tools/devel/view.tag.html).  and i don't
> think it's what you are talking about.  it will stay awkward for you,
> so long as you don't have your terms right, because you won't be able
> to find the right documentation.
> 
>> The main question which is unanswered is why does velocity introduce its
>> own
>> <tr> and <td> tags for #slabel,#ssubmit etc.
> 
> Velocity doesn't do that.  However, i believe Struts 2/WebWork does
> introduce things like that.  You should probably be asking them about
> it. (user@struts.apache.org)
> 
>>  I want to have a table with 3
>> columns first with a html label, second with a submit button and third to
>> display the result.  Clearly velocity is limited to basic design and i
>> feel
>> not worth for designing a good web application.
> 
> I would argue that not much about this is quite clear to you yet. :)
> Still, if you are using Struts 2, i know they do support other options
> for templating.  Perhaps you will find something else to be better
> documented.  But really, i would ask on that list first, since it
> appears that your questions involve their custom Velocity directives,
> rather than the core Velocity functionality.
> 
>>
>>
>>
>> Nathan Bubna wrote:
>> >
>> > http://velocity.apache.org/tools/releases/1.4/struts/
>> >
>> > The VelocityTools binary distribution also comes with a VelocityStruts
>> > example application that is quite instructive.  I'd recommend
>> > downloading that and dropping the struts.war file in your favorite
>> > servlet engine and playing around with it.  The source code for that
>> > example is also quite handy, if you download the VelocityTools source
>> > distribution.
>> >
>> > On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
>> >>
>> >> Hi,
>> >> Can any one direct me to velocity-struts tutorials or any document
>> >> describing velocity tags and elements?.
>> >>
>> >> Thanks  in advance
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
>> >> Sent from the Velocity - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> >> For additional commands, e-mail: user-help@velocity.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> > For additional commands, e-mail: user-help@velocity.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Velocity-reference-tp19415249p19456786.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19458039.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Velocity reference

Posted by Nathan Bubna <nb...@gmail.com>.
On Fri, Sep 12, 2008 at 7:15 AM, m_kk <ki...@yahoo.com> wrote:
>
> Thanks for the resource. Unfortunately none of the examples use velocity
> tags. Its quite awkward  not to find  proper resource and also don't
> understand the need of velocity when there is struts tags already.

there is only one velocity "tag" these days
(http://velocity.apache.org/tools/devel/view.tag.html).  and i don't
think it's what you are talking about.  it will stay awkward for you,
so long as you don't have your terms right, because you won't be able
to find the right documentation.

> The main question which is unanswered is why does velocity introduce its own
> <tr> and <td> tags for #slabel,#ssubmit etc.

Velocity doesn't do that.  However, i believe Struts 2/WebWork does
introduce things like that.  You should probably be asking them about
it. (user@struts.apache.org)

>  I want to have a table with 3
> columns first with a html label, second with a submit button and third to
> display the result.  Clearly velocity is limited to basic design and i feel
> not worth for designing a good web application.

I would argue that not much about this is quite clear to you yet. :)
Still, if you are using Struts 2, i know they do support other options
for templating.  Perhaps you will find something else to be better
documented.  But really, i would ask on that list first, since it
appears that your questions involve their custom Velocity directives,
rather than the core Velocity functionality.

>
>
>
> Nathan Bubna wrote:
> >
> > http://velocity.apache.org/tools/releases/1.4/struts/
> >
> > The VelocityTools binary distribution also comes with a VelocityStruts
> > example application that is quite instructive.  I'd recommend
> > downloading that and dropping the struts.war file in your favorite
> > servlet engine and playing around with it.  The source code for that
> > example is also quite handy, if you download the VelocityTools source
> > distribution.
> >
> > On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
> >>
> >> Hi,
> >> Can any one direct me to velocity-struts tutorials or any document
> >> describing velocity tags and elements?.
> >>
> >> Thanks  in advance
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
> >> Sent from the Velocity - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >> For additional commands, e-mail: user-help@velocity.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19456786.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

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


Re: Velocity reference

Posted by Pe...@blm.gov.
I have to say that I think you may be trying to run before you can walk
with this (too much Velocity? :)

My suggestion would be to start simple - write a standalone application
that just has a main method that creates and configures a VelocityEngine
then uses it to merge a context with a template file. The idea is to get
familiar with the basics - how to configure a resource loader, how to write
a basic template. From there try some other things, like passing POJOs as
context values and calling their methods from the a template. Try putting
your template into a JAR and using the ClassPathResourceLoader. Add the
toolbox to the mix to get a feel for how it works. You get the idea.

When you're comfortable with using Velocity like this, then you'll be way
better prepared for the more advanced stuff like using Velocity and Struts
side by side (and in my experience this combination blows the socks off
Struts+JSP in terms of performance and maintainability, and to some degree
even portability).

--Pete

m_kk <ki...@yahoo.com> wrote on 09/12/2008 08:15:57 AM:

>
> Thanks for the resource. Unfortunately none of the examples use velocity
> tags. Its quite awkward  not to find  proper resource and also don't
> understand the need of velocity when there is struts tags already.
>
> The main question which is unanswered is why does velocity introduce its
own
> <tr> and <td> tags for #slabel,#ssubmit etc.  I want to have a table with
3
> columns first with a html label, second with a submit button and third to
> display the result.  Clearly velocity is limited to basic design and i
feel
> not worth for designing a good web application.
>
>
>
> Nathan Bubna wrote:
> >
> > http://velocity.apache.org/tools/releases/1.4/struts/
> >
> > The VelocityTools binary distribution also comes with a VelocityStruts
> > example application that is quite instructive.  I'd recommend
> > downloading that and dropping the struts.war file in your favorite
> > servlet engine and playing around with it.  The source code for that
> > example is also quite handy, if you download the VelocityTools source
> > distribution.
> >
> > On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
> >>
> >> Hi,
> >> Can any one direct me to velocity-struts tutorials or any document
> >> describing velocity tags and elements?.
> >>
> >> Thanks  in advance
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
> >> Sent from the Velocity - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >> For additional commands, e-mail: user-help@velocity.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: user-help@velocity.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Velocity-
> reference-tp19415249p19456786.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>


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


Re: Velocity reference

Posted by m_kk <ki...@yahoo.com>.
Thanks for the resource. Unfortunately none of the examples use velocity
tags. Its quite awkward  not to find  proper resource and also don't
understand the need of velocity when there is struts tags already.   

The main question which is unanswered is why does velocity introduce its own
<tr> and <td> tags for #slabel,#ssubmit etc.  I want to have a table with 3
columns first with a html label, second with a submit button and third to
display the result.  Clearly velocity is limited to basic design and i feel
not worth for designing a good web application. 

 

Nathan Bubna wrote:
> 
> http://velocity.apache.org/tools/releases/1.4/struts/
> 
> The VelocityTools binary distribution also comes with a VelocityStruts
> example application that is quite instructive.  I'd recommend
> downloading that and dropping the struts.war file in your favorite
> servlet engine and playing around with it.  The source code for that
> example is also quite handy, if you download the VelocityTools source
> distribution.
> 
> On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
>>
>> Hi,
>> Can any one direct me to velocity-struts tutorials or any document
>> describing velocity tags and elements?.
>>
>> Thanks  in advance
>> --
>> View this message in context:
>> http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19456786.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Velocity reference

Posted by Nathan Bubna <nb...@gmail.com>.
http://velocity.apache.org/tools/releases/1.4/struts/

The VelocityTools binary distribution also comes with a VelocityStruts
example application that is quite instructive.  I'd recommend
downloading that and dropping the struts.war file in your favorite
servlet engine and playing around with it.  The source code for that
example is also quite handy, if you download the VelocityTools source
distribution.

On Wed, Sep 10, 2008 at 11:05 AM, m_kk <ki...@yahoo.com> wrote:
>
> Hi,
> Can any one direct me to velocity-struts tutorials or any document
> describing velocity tags and elements?.
>
> Thanks  in advance
> --
> View this message in context: http://www.nabble.com/Velocity-reference-tp19415249p19415249.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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