velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kelly.muniz" <kmu...@cisco.com>
Subject RE: objects with properties
Date Fri, 11 Apr 2003 23:58:21 GMT


Andrew, the object ("obj") I referred to below is not a Java object.
I wanted to create a Velocity object at the time the template is being
processed, just for use within the template.

Thanks.

> -----Original Message-----
> From: Andrew Tetlaw [mailto:andrew_tetlaw@bvn.com.au]
> Sent: Friday, April 11, 2003 3:05 PM
> To: Velocity Users List
> Subject: Re: objects with properties
>
>
> But you could implement your own solution.
>
> Make a method for the class represented by 'obj' like:
>
> public String setName(String name) {}
>
> making sure it returns "" or even something like "<!-- setting name to
> "xxxx" -->" (if you're outputing html)
>
> then just put $obj.setName("name") in your template.
>
> You forget about the result but you should now be able to use
> $obj.name in
> your template.
>
> I'm a bit of a java/Velocity newbie, but I think that'd work... wouldn't
> it?
>
> Well if it wouldn't then an event cartridge would surely allow you to do
> it?
>
> Cheers,
> Andrew Tetlaw
>
> Bligh Voller Nield
> http://www.bvn.com.au
> p: (07) 3251 5778
> f: (07) 3852 2544
>
> "Nathan Bubna" <nathan@esha.com> wrote on 12/04/2003 07:17:18 AM:
>
> > kelly said:
> > > I noticed that creating objects with properties in velocity is not
> > > supported.  For example:
> > >
> > > #set( $obj.name = "name" )
> > > #set( $obj.lastname = "lastname" )
> > > #set( $obj.age = 22 )
> > >
> > > $obj.name, $obj.lastname ( $obj.age )
> > >
> > > Will this be supported sometime in the future?
> >
> > nope, not as you describe.  this is not javascript.
> >
> > however, velocity will hopefully support creating hashmaps in the
> > not-too-distant future.  a patch has been submitted and was generally
> > approved.  it's just waiting on developer action.  just search the
> dev-list
> > archives for more on the subject of map support.
> >
> > Nathan Bubna
> > nathan@esha.com
>
>
>
> <font face="Arial, Helvetica, sans-serif" size="2">
> <b>
>
> Please Also Note
> </b>This document, including attachments, is only intended for
> the addressees and may contain privileged or confidential
> information. Unauthorised use, copying or distribution of the
> document or any part of its contents, is prohibited. If you
> receive this Email in error please notify us by return Email or
> telephone. We will reimburse you for any reasonable expenses
> incurred in meeting this request.</font>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message