You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Nathan Bubna <na...@esha.com> on 2003/07/17 06:34:15 UTC

[ANNOUNCEMENT] Velocity Tools 1.0 released

I am happy to announce the release of Velocity Tools 1.0!

Velocity Tools is a collection of Velocity subprojects offering servlets and
tools for rapid, clean web development with Velocity, tools for using Velocity
with Struts, and a set of generic tools to help with any Velocity project.

Both source (http://jakarta.apache.org/site/sourceindex.cgi) and binary
(http://jakarta.apache.org/site/binindex.cgi) distributions are available
through the the usual Apache mirror sites. Please remember to verify the
signatures of the distribution using the keys found on the main Apache web
site (http://www.apache.org/dist/jakarta/velocity-tools/KEYS) when downloading
from a mirror.

Please see the Velocity Tools website
(http://jakarta.apache.org/velocity/tools/index.html) for more information.

Nathan Bubna
nathan@esha.com


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Martin Jacobson <ma...@libero.it>.
Nathan Bubna wrote:
<lots of useful info snipped!>

Thanks a lot, Nathan! It would need too much code-refactoring to be 
applicable to my current project, but I'll definitely give a try in the 
next!

Martin.


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Nathan Bubna <na...@esha.com>.
Martin Jacobson said:
> I'm sure this is Good Stuff, but I can't find any documentation that
> might help a simple bloke like me make the transition from
> VelocityServlet...

hmm.  could be a doc worth writing.  in the meantime, i think the
velocity-tools example apps could be quite helpful to you.  and, of course,
you can keep asking questions here too. :)

> Currently, I extend VelocityServlet, process the request, place data in
> the Context, and return the appropriate Template. All this works well.
> It seems that to use ViewServlet, my servlet has to extend HttpServlet
> instead, and then forward to a URL (<myapp>/myTemplate.vm), which will
> be processed by ViewServlet. All well and good, but where does the
> Context data go? For example, consider the following code from my Servlet:
>
> BizPerson bizP = new BizPerson(...);
> PersonBean pb = bizP.read(req.getParameter("oid"));
> ctx.put("person", pb);

with velocity-tools you could create a PersonTool that implements the ViewTool
interface.  something like:

public class PersonTool implements ViewTool
{
    BizPerson bizP = new BizPerson(...);
    PersonBean bean;

    public void init(Object obj)
    {
        ViewContext context = (ViewContext)obj;
        this.request = context.getRequest();
        bean = bizP.read(request.getParameter("oid");
    }

    public PersonBean getBean()
    {
        return bean;
    }
}

you would then just specify this in your toolbox.xml like this:

<toolbox>
    <tool>
        <key>person</key>
        <scope>request</scope>
        <class>foo.bar.PersonTool</class>
    </tool>
</toolbox>

and your tool would be automatically available in all of your templates just
like this:

$person.bean

this is just one option of a number, you might also make a BeanTool and ask it
for a person ($bean.person) or just make your PersonBean class implement
ViewTool itself.  the actual organization depends a lot on the particular
application.

> my template then can show person data using, eg: $person.surname

which would become $person.bean.surname

> What is the paradigm now? Is it one of these tool thingies? How does
> this work?

yes, tools are the way to go.  i'd recommend playing with the examples and
reading
http://jakarta.apache.org/velocity/tools/view/  to help you get a grip on the
paradigm.

>  Help! Help!

ok! ok!  :)

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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Nathan Bubna <na...@esha.com>.
Martin Jacobson said:
> ... or (answering my own mail), is VelocityViewServlet a drop-in
> replacement for the old VelocityServlet?

i believe it can be, but it has much more to offer than the VelocityServlet.
if you just drop in replace, you'll get a few bugfixes and simplifications of
resource loading and logging (assuming you don't override the default
velocity.properties), but then you still won't be taking advantage of the
toolbox support.

Nathan Bubna
nathan


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Martin Jacobson <ma...@libero.it>.
... or (answering my own mail), is VelocityViewServlet a drop-in 
replacement for the old VelocityServlet?

Martin


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Martin Jacobson <ma...@libero.it>.
I'm sure this is Good Stuff, but I can't find any documentation that 
might help a simple bloke like me make the transition from 
VelocityServlet...

Currently, I extend VelocityServlet, process the request, place data in 
the Context, and return the appropriate Template. All this works well. 
It seems that to use ViewServlet, my servlet has to extend HttpServlet 
instead, and then forward to a URL (<myapp>/myTemplate.vm), which will 
be processed by ViewServlet. All well and good, but where does the 
Context data go? For example, consider the following code from my Servlet:

BizPerson bizP = new BizPerson(...);
PersonBean pb = bizP.read(req.getParameter("oid"));
ctx.put("person", pb);

my template then can show person data using, eg: $person.surname

What is the paradigm now? Is it one of these tool thingies? How does 
this work? Help! Help!

Thanks,
Martin.


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Nathan Bubna" <na...@esha.com> writes:

> I am happy to announce the release of Velocity Tools 1.0!
> 
> Velocity Tools is a collection of Velocity subprojects offering servlets and
> tools for rapid, clean web development with Velocity, tools for using Velocity
> with Struts, and a set of generic tools to help with any Velocity project.
> 
> Both source (http://jakarta.apache.org/site/sourceindex.cgi) and binary
> (http://jakarta.apache.org/site/binindex.cgi) distributions are available
> through the the usual Apache mirror sites. Please remember to verify the
> signatures of the distribution using the keys found on the main Apache web
> site (http://www.apache.org/dist/jakarta/velocity-tools/KEYS) when downloading
> from a mirror.
> 
> Please see the Velocity Tools website
> (http://jakarta.apache.org/velocity/tools/index.html) for more information.

Kudos to everyone involved!  Open source loves a 1.0.
-- 

Daniel Rall

Re: [PATCH] Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Tetsuya Kitahata <te...@apache.org> writes:

> Forgotten to put the [PATCH]
> :D
> 
> Sincerely,
> 
> -- Tetsuya (tetsuya@apache.org) --  AIM# tkitahata
> 
> ---------------------------------------------------------------------
> 
> Index: index.xml
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity-tools/xdocs/index.xml,v
> retrieving revision 1.8
> diff -u -r1.8 index.xml
> --- index.xml	9 Jul 2003 23:48:00 -0000	1.8
> +++ index.xml	18 Jul 2003 07:28:51 -0000
> @@ -84,7 +84,7 @@
>          <p>Web Browser: <a href="http://cvs.apache.org/viewcvs/jakarta-velocity-tools/">
>          http://cvs.apache.org/viewcvs/jakarta-velocity-tools/</a></p>
>  
> -        <p>CVS Client: <a href="http://jakarta.apache.org/getinvolved/cvsindex.html">http://jakarta.apache.org/getinvolved/cvsindex.html</a>.
> +        <p>CVS Client: <a href="http://jakarta.apache.org/site/cvsindex.html">http://jakarta.apache.org/site/cvsindex.html</a>.
>          </p>
>          <br clear="all"/>
>      </section>
> Index: site.dvsl
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity-tools/xdocs/site.dvsl,v
> retrieving revision 1.9
> diff -u -r1.9 site.dvsl
> --- site.dvsl	26 Apr 2003 01:23:37 -0000	1.9
> +++ site.dvsl	18 Jul 2003 07:28:57 -0000
> @@ -136,7 +136,7 @@
>        <!-- PAGE FOOTER -->
>        <tr><td colspan="2">
>          <div align="center"><font color="$body-link" size="-1"><em>
> -        Copyright &#169; 1999-2002, Apache Software Foundation
> +        Copyright &#169; 1999-2003, Apache Software Foundation
>          </em></font></div>
>        </td></tr>

Nathan got it, thanks Tetsuya.
-- 

Daniel Rall

[PATCH] Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Tetsuya Kitahata <te...@apache.org>.
Forgotten to put the [PATCH]
:D

Sincerely,

-- Tetsuya (tetsuya@apache.org) --  AIM# tkitahata

---------------------------------------------------------------------

Index: index.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity-tools/xdocs/index.xml,v
retrieving revision 1.8
diff -u -r1.8 index.xml
--- index.xml	9 Jul 2003 23:48:00 -0000	1.8
+++ index.xml	18 Jul 2003 07:28:51 -0000
@@ -84,7 +84,7 @@
         <p>Web Browser: <a href="http://cvs.apache.org/viewcvs/jakarta-velocity-tools/">
         http://cvs.apache.org/viewcvs/jakarta-velocity-tools/</a></p>
 
-        <p>CVS Client: <a href="http://jakarta.apache.org/getinvolved/cvsindex.html">http://jakarta.apache.org/getinvolved/cvsindex.html</a>.
+        <p>CVS Client: <a href="http://jakarta.apache.org/site/cvsindex.html">http://jakarta.apache.org/site/cvsindex.html</a>.
         </p>
         <br clear="all"/>
     </section>
Index: site.dvsl
===================================================================
RCS file: /home/cvs/jakarta-velocity-tools/xdocs/site.dvsl,v
retrieving revision 1.9
diff -u -r1.9 site.dvsl
--- site.dvsl	26 Apr 2003 01:23:37 -0000	1.9
+++ site.dvsl	18 Jul 2003 07:28:57 -0000
@@ -136,7 +136,7 @@
       <!-- PAGE FOOTER -->
       <tr><td colspan="2">
         <div align="center"><font color="$body-link" size="-1"><em>
-        Copyright &#169; 1999-2002, Apache Software Foundation
+        Copyright &#169; 1999-2003, Apache Software Foundation
         </em></font></div>
       </td></tr>
 

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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Tetsuya Kitahata <te...@apache.org>.
Congrats! Velocity-Tools Team!

By the way,

1. Look at the footer of each pages: "Copyright 1999-2002"
   This should be "Copyright 1999-2003" or "Copyright 2003"

2. http://jakarta.apache.org/velocity/tools/index.html#CVS%20Repository

... http://jakarta.apache.org/getinvolved/cvsindex.html
-> http://jakarta.apache.org/site/cvsindex.html

Sincerely,

-- Tetsuya (tetsuya@apache.org) --  AIM# tkitahata

---------------------------------------------------------------------

On Wed, 16 Jul 2003 21:34:15 -0700
(Subject: [ANNOUNCEMENT] Velocity Tools 1.0 released)
"Nathan Bubna" <na...@esha.com> wrote:

> I am happy to announce the release of Velocity Tools 1.0!
> 
> Velocity Tools is a collection of Velocity subprojects offering servlets and
> tools for rapid, clean web development with Velocity, tools for using Velocity
> with Struts, and a set of generic tools to help with any Velocity project.
> 
> Both source (http://jakarta.apache.org/site/sourceindex.cgi) and binary
> (http://jakarta.apache.org/site/binindex.cgi) distributions are available
> through the the usual Apache mirror sites. Please remember to verify the
> signatures of the distribution using the keys found on the main Apache web
> site (http://www.apache.org/dist/jakarta/velocity-tools/KEYS) when downloading
> from a mirror.
> 
> Please see the Velocity Tools website
> (http://jakarta.apache.org/velocity/tools/index.html) for more information.
> 
> Nathan Bubna
> nathan@esha.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org

-----------------------------------------------------
Tetsuya Kitahata --  Terra-International, Inc.
E-mail: kitahata@bb.mbn.or.jp : tetsuya@apache.org
http://www.terra-intl.com/
(Apache Jakarta Translation, Japanese)
http://jakarta.terra-intl.com/



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


Re: Struts 1.1 support

Posted by Nathan Bubna <na...@esha.com>.
Marinó A. Jónsson said:
> I actually missed Tom's email so thanks for reposting :)  There are three
> main differences between my version and his ...
>
> my version supports nested tiles
> my version supports tile-controllers
> my version doesn't require a velocity-macro

sounds good.

> Tiles are _very_ simple to use and I have already prepared a little demo-app
> you can use to get up to speed :)  It features the TilesTool used with
> Velocity and Struts, and also an example of how to use a tile-controller.

sounds even better.

> Do you want it sent to nathan@esha.com?

sure.  or wiki or you can try posting to the list. (not sure if that'll work,
attachments seem to be stripped these days.  though i think *.txt files might
work.)

> Regarding module support I'll start looking at StrutsUtils :)

:) great!

Nathan Bubna
nathan@esha.com


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


Re: Struts 1.1 support

Posted by Nathan Bubna <na...@esha.com>.
Marinó A. Jónsson said:
...
> http://nagoya.apache.org/wiki/apachewiki.cgi?TilesTool
>
> (you can also find it under 'Contributed Code and Examples' in the
> VelocityProjectPages :)

i just linked to it on the VelocityTools wiki page as well.

> This is just the TilesTool class though ... Nathan, my offer to email the
> demo-app still stands :)

yeah, pass it my way or wiki or whatever you feel like.  (Wiki is good for
community interaction--don't wanna leave Tim out in the cold ;)

Nathan Bubna
nathan@esha.com


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


[VELTOOLS] Struts 1.0 Javascript Validation Tool

Posted by Tim Colson <tc...@cisco.com>.
> -----Original Message-----
> From: Marinó A. Jónsson [mailto:marinoj@centrum.is] 
> Sent: Wednesday, July 23, 2003 8:43 AM
> how is your client-side javascript validation access coming? 
> ... I'm pretty curious about that ;)

I just posted a quick hack version on the Wiki. :-)

http://nagoya.apache.org/wiki/apachewiki.cgi?VelocityValidationTool

The good news is that it seems to actually even work, the bad news is
that I probably need to get Struts 1.1 to run locally before I can start
upgrading it to use the commons validation and Struts 1.1 features.

But at least this is a start for those of us currently stuck in 1.0
land. <grin>

Cheers,
Timo


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


RE: Struts 1.1 support

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
<grinrightbackatyah> :P

how is your client-side javascript validation access coming? ... I'm pretty
curious about that ;)

Cheers,
Marino

-----Original Message-----
From: Tim Colson [mailto:tcolson@cisco.com] 
Sent: 23. júlí 2003 15:33
To: 'Velocity Developers List'
Subject: RE: Struts 1.1 support

> Ok Timo - the TilesTool has been posted so you can satisfy 
> your extreme curiousity ;)
Fantastic. :-)

> This is just the TilesTool class though ... 
> Nathan, my offer to email the demo-app still stands :)
Oh! I was hoping you'd post the demo-app there too, I'm intensely
interested in that too. <grin>

Timo


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




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


RE: Struts 1.1 support

Posted by Tim Colson <tc...@cisco.com>.
> Ok Timo - the TilesTool has been posted so you can satisfy 
> your extreme curiousity ;)
Fantastic. :-)

> This is just the TilesTool class though ... 
> Nathan, my offer to email the demo-app still stands :)
Oh! I was hoping you'd post the demo-app there too, I'm intensely
interested in that too. <grin>

Timo


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


RE: Struts 1.1 support

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
Damn - this Wiki is pretty cool :D

Ok Timo - the TilesTool has been posted so you can satisfy your extreme
curiousity ;)

http://nagoya.apache.org/wiki/apachewiki.cgi?TilesTool

(you can also find it under 'Contributed Code and Examples' in the
VelocityProjectPages :)

This is just the TilesTool class though ... Nathan, my offer to email the
demo-app still stands :)

Cheers,
Marino


-----Original Message-----
From: Tim Colson [mailto:tcolson@cisco.com] 
Sent: 23. júlí 2003 14:28
To: 'Velocity Developers List'
Subject: RE: Struts 1.1 support

Marino -

> Do you want it sent to nathan@esha.com?
How about posting this onto the Wiki so we can all have a look - I'm
extremely curious. :-)

http://nagoya.apache.org/wiki/apachewiki.cgi?VelocityProjectPages

Thanks!
Tim


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




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


RE: Struts 1.1 support

Posted by Tim Colson <tc...@cisco.com>.
Marino -

> Do you want it sent to nathan@esha.com?
How about posting this onto the Wiki so we can all have a look - I'm
extremely curious. :-)

http://nagoya.apache.org/wiki/apachewiki.cgi?VelocityProjectPages

Thanks!
Tim


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


RE: Struts 1.1 support

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
I actually missed Tom's email so thanks for reposting :)  There are three
main differences between my version and his ... 

my version supports nested tiles
my version supports tile-controllers 
my version doesn't require a velocity-macro  

Tiles are _very_ simple to use and I have already prepared a little demo-app
you can use to get up to speed :)  It features the TilesTool used with
Velocity and Struts, and also an example of how to use a tile-controller.
Do you want it sent to nathan@esha.com?

Regarding module support I'll start looking at StrutsUtils :)

Cheers,
Marino


-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com] 
Sent: 23. júlí 2003 05:08
To: Velocity Developers List
Subject: Re: Struts 1.1 support

Marinó A. Jónsson said:
...
> I miss seeing a listing for Tiles and Modules in the Status doc though.
As
> I've already stated I have að working TilesTool to contribute (although it
> lacks support for put-lists).  I could also use struts modules in my
> projects ... so maybe I can lend a hand with that?

yeah, i would love it if you'd lend a hand!  i haven't used either Tiles or
Modules, and really don't know a lot about them.  any help you could give
would be fantastic. patches and contributions are more than welcome.
sometimes it feels like a one man show these days.  i'm very eager to get
more
developers involved (and hopefully some will merit becoming committers).

i've looked into Tiles a little.  Tom Czarniecki also posted a TilesTool
that
he made to the user list.  but i'm not sure how to use it or evaluate it
given
my current level of understanding.  i'd be interested to hear your thoughts
on
it and see your code too (an example of how to use it might help me
understand
:).  anyway, i've reposted his email at the bottom of this one in case you
missed it.

Nathan Bubna
nathan@esha.com

-----------------------------------------------------------------
from: tomcz@ozemail.com.au
-----------------------------------------------------------------
Hi there,
I would like to contribute my version of a tiles tool for velocity. This
tool is designed to be used as part of a velocity toolbox and provides a
simple way of accessing struts-tiles defintions to allow velocity templates
to be used in the struts-tiles framework rather than jsp pages. This tool
does not parse nested component contexts since that is not required for my
purposes but it can easily be extended.

I use this tool with the following velocimacro:
## Parse a VM template returned by a Tiles definition.
#macro(tilesParse $name)
#if( $tiles.exists($name) )
#parse( $tiles.get($name) )
#end
#end

Source code follows:
/*
 * $Id: TilesTool.java,v 1.1 2003/07/13 03:51:24 Tom Exp $
 */
package com.tomczarniecki.velocity;

import org.apache.struts.taglib.tiles.ComponentConstants;
import org.apache.struts.tiles.ComponentContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.tools.view.context.ViewContext;
import org.apache.velocity.tools.view.tools.ViewTool;

/**
 * TODO: add description
 *
 * @author  Tom Czarniecki
 * @version $Revision: 1.1 $
 */
public class TilesTool implements ViewTool {

    //
------------------------------------------------------------------------
    // Class variables and constants

    //
------------------------------------------------------------------------
    // Instance variables

    private ViewContext m_viewCtx;

    //
------------------------------------------------------------------------
    // Constructor(s)

    //
------------------------------------------------------------------------
    // Public methods

    public void init(Object obj) {
        if (obj instanceof ViewContext) {
            m_viewCtx = (ViewContext) obj;
        } else {
            throw new IllegalArgumentException(
                    "Tool can only be initialized with a ViewContext");
        }
    }

    public String get(String name) {
        Object ctx =
m_viewCtx.getRequest().getAttribute(ComponentConstants.COMPONENT_CONTEXT);
        if (ctx instanceof ComponentContext) {
            ComponentContext compCtx = (ComponentContext) ctx;
            Object value = compCtx.getAttribute(name);
            if (value instanceof String) {
                return (String) value;
            } else {
                Velocity.warn("Invalid ComponentContext attribute class for
key '" + name +
                        "': expected " + String.class + ", actual " +
getClassName(value));
            }
        } else {
            Velocity.warn("Invalid HttpServletRequest attribute class for
key '" +
                    ComponentConstants.COMPONENT_CONTEXT + "': expected " +
                    ComponentContext.class + ", actual " +
getClassName(ctx));
        }
        return "";
    }

    public boolean exists(String name) {
        String value = get(name);
        return (value.length() > 0);
    }

    //
------------------------------------------------------------------------
    // Private methods

    private String getClassName(Object obj) {
        return (obj != null) ? obj.getClass().getName() : "null";
    }
}



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



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


Re: Struts 1.1 support

Posted by Nathan Bubna <na...@esha.com>.
Marinó A. Jónsson said:
...
> I miss seeing a listing for Tiles and Modules in the Status doc though.  As
> I've already stated I have að working TilesTool to contribute (although it
> lacks support for put-lists).  I could also use struts modules in my
> projects ... so maybe I can lend a hand with that?

yeah, i would love it if you'd lend a hand!  i haven't used either Tiles or
Modules, and really don't know a lot about them.  any help you could give
would be fantastic. patches and contributions are more than welcome.
sometimes it feels like a one man show these days.  i'm very eager to get more
developers involved (and hopefully some will merit becoming committers).

i've looked into Tiles a little.  Tom Czarniecki also posted a TilesTool that
he made to the user list.  but i'm not sure how to use it or evaluate it given
my current level of understanding.  i'd be interested to hear your thoughts on
it and see your code too (an example of how to use it might help me understand
:).  anyway, i've reposted his email at the bottom of this one in case you
missed it.

Nathan Bubna
nathan@esha.com

-----------------------------------------------------------------
from: tomcz@ozemail.com.au
-----------------------------------------------------------------
Hi there,
I would like to contribute my version of a tiles tool for velocity. This
tool is designed to be used as part of a velocity toolbox and provides a
simple way of accessing struts-tiles defintions to allow velocity templates
to be used in the struts-tiles framework rather than jsp pages. This tool
does not parse nested component contexts since that is not required for my
purposes but it can easily be extended.

I use this tool with the following velocimacro:
## Parse a VM template returned by a Tiles definition.
#macro(tilesParse $name)
#if( $tiles.exists($name) )
#parse( $tiles.get($name) )
#end
#end

Source code follows:
/*
 * $Id: TilesTool.java,v 1.1 2003/07/13 03:51:24 Tom Exp $
 */
package com.tomczarniecki.velocity;

import org.apache.struts.taglib.tiles.ComponentConstants;
import org.apache.struts.tiles.ComponentContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.tools.view.context.ViewContext;
import org.apache.velocity.tools.view.tools.ViewTool;

/**
 * TODO: add description
 *
 * @author  Tom Czarniecki
 * @version $Revision: 1.1 $
 */
public class TilesTool implements ViewTool {

    //
------------------------------------------------------------------------
    // Class variables and constants

    //
------------------------------------------------------------------------
    // Instance variables

    private ViewContext m_viewCtx;

    //
------------------------------------------------------------------------
    // Constructor(s)

    //
------------------------------------------------------------------------
    // Public methods

    public void init(Object obj) {
        if (obj instanceof ViewContext) {
            m_viewCtx = (ViewContext) obj;
        } else {
            throw new IllegalArgumentException(
                    "Tool can only be initialized with a ViewContext");
        }
    }

    public String get(String name) {
        Object ctx =
m_viewCtx.getRequest().getAttribute(ComponentConstants.COMPONENT_CONTEXT);
        if (ctx instanceof ComponentContext) {
            ComponentContext compCtx = (ComponentContext) ctx;
            Object value = compCtx.getAttribute(name);
            if (value instanceof String) {
                return (String) value;
            } else {
                Velocity.warn("Invalid ComponentContext attribute class for
key '" + name +
                        "': expected " + String.class + ", actual " +
getClassName(value));
            }
        } else {
            Velocity.warn("Invalid HttpServletRequest attribute class for
key '" +
                    ComponentConstants.COMPONENT_CONTEXT + "': expected " +
                    ComponentContext.class + ", actual " + getClassName(ctx));
        }
        return "";
    }

    public boolean exists(String name) {
        String value = get(name);
        return (value.length() > 0);
    }

    //
------------------------------------------------------------------------
    // Private methods

    private String getClassName(Object obj) {
        return (obj != null) ? obj.getClass().getName() : "null";
    }
}



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


Struts 1.1 support

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
yeah ... definately looking forward to official Struts 1.1 support next :)

I miss seeing a listing for Tiles and Modules in the Status doc though.  As
I've already stated I have að working TilesTool to contribute (although it
lacks support for put-lists).  I could also use struts modules in my
projects ... so maybe I can lend a hand with that?

Cheers,
Marino

-----Original Message-----
From: Tim Colson [mailto:tcolson@cisco.com] 
Sent: 17. júlí 2003 14:29
To: velocity-dev@jakarta.apache.org
Cc: Gabriel Sidler
Subject: RE: [ANNOUNCEMENT] Velocity Tools 1.0 released

Whoo Hoo! Great work Nathan! :-)

I removed the temporary docs on happysearch.com. 

Gabe, perhaps the docs here should be removed to, now that there is an
official version.
http://www.teamup.com/jakarta-velocity-tools/tools/docs/ 

Looking forward to official Struts 1.1 support next! (I'll be able to
use it within a few weeks, so I'll get busy converting the taglib to a
tool so Velocity can access the client-side javascript validation the
Validator provides.)

Cheers,
Timo


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




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


RE: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Tim Colson <tc...@cisco.com>.
Whoo Hoo! Great work Nathan! :-)

I removed the temporary docs on happysearch.com. 

Gabe, perhaps the docs here should be removed to, now that there is an
official version.
http://www.teamup.com/jakarta-velocity-tools/tools/docs/ 

Looking forward to official Struts 1.1 support next! (I'll be able to
use it within a few weeks, so I'll get busy converting the taglib to a
tool so Velocity can access the client-side javascript validation the
Validator provides.)

Cheers,
Timo


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Nathan Bubna <na...@esha.com>.
Denis said:
> Thank you for putting in IteratorTool as a tool in the project.

you're welcome.  i don't use it myself, but cases where people wanted
similar/related capabilities seem to have come up enough in the past that i
felt it was a worthwhile addition.  thanks for writing it!

> I would be happy to receive any suggestion for the documentation, it
> needs some work. A Velocity-tools compliant format and better examples
> are some improvements to do but more ideas are welcome.

i think a more "realistic" example than the one currently in the javadoc would
be the biggest need i think, but it would certainly be nice to have a
documentation page for it in the velocity-tools format as well.

as always, i'm more than happy to accept patches for the documentation or
examples!  just post them to bugzilla or send them to the list (that doesn't
always work though).

Nathan Bubna
nathan@esha.com


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


Re: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Denis <br...@mac.com>.
Nathan,

Thank you for putting in IteratorTool as a tool in the project.
I would be happy to receive any suggestion for the documentation, it 
needs some work. A Velocity-tools compliant format and better examples 
are some improvements to do but more ideas are welcome.

Thanks,
-- Denis.

On Thursday, July 17, 2003, at 05:34  am, Nathan Bubna wrote:

> I am happy to announce the release of Velocity Tools 1.0!
>
> Velocity Tools is a collection of Velocity subprojects offering 
> servlets and
> tools for rapid, clean web development with Velocity, tools for using 
> Velocity
> with Struts, and a set of generic tools to help with any Velocity 
> project.
>
> Both source (http://jakarta.apache.org/site/sourceindex.cgi) and binary
> (http://jakarta.apache.org/site/binindex.cgi) distributions are 
> available
> through the the usual Apache mirror sites. Please remember to verify 
> the
> signatures of the distribution using the keys found on the main Apache 
> web
> site (http://www.apache.org/dist/jakarta/velocity-tools/KEYS) when 
> downloading
> from a mirror.
>
> Please see the Velocity Tools website
> (http://jakarta.apache.org/velocity/tools/index.html) for more 
> information.
>
> Nathan Bubna
> nathan@esha.com
>


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


RE: [ANNOUNCEMENT] Velocity Tools 1.0 released

Posted by Tim Colson <tc...@cisco.com>.
Whoo Hoo!

Great work Nathan :-)

Timo


> -----Original Message-----
> From: Nathan Bubna [mailto:nathan@esha.com] 
> Sent: Wednesday, July 16, 2003 9:34 PM
> To: velocity-dev@jakarta.apache.org; Velocity Users List
> Subject: [ANNOUNCEMENT] Velocity Tools 1.0 released
> 
> 
> I am happy to announce the release of Velocity Tools 1.0!
> 
> Velocity Tools is a collection of Velocity subprojects 
> offering servlets and
> tools for rapid, clean web development with Velocity, tools 
> for using Velocity
> with Struts, and a set of generic tools to help with any 
> Velocity project.
> 
> Both source (http://jakarta.apache.org/site/sourceindex.cgi) 
> and binary
> (http://jakarta.apache.org/site/binindex.cgi) distributions 
> are available
> through the the usual Apache mirror sites. Please remember to 
> verify the
> signatures of the distribution using the keys found on the 
> main Apache web
> site (http://www.apache.org/dist/jakarta/velocity-tools/KEYS) 
> when downloading
> from a mirror.
> 
> Please see the Velocity Tools website
> (http://jakarta.apache.org/velocity/tools/index.html) for 
> more information.
> 
> Nathan Bubna
> nathan@esha.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-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