velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Bardhan <Amit.Bard...@LOSTWAX.COM>
Subject RE: Returning empty string instead of $bean.property
Date Fri, 25 Aug 2006 14:35:40 GMT
Try this: -
<Book>
        <Title>#if($book.title)$book.title#end</Title>
</Book>


Regards
Amit





-----Original Message-----
From: Matjaž Trtnik [mailto:Matjaz.Trtnik@genis.si]
Sent: 25 August 2006 15:27
To: velocity-user@jakarta.apache.org
Subject: Returning empy string isead of $bean.property


Hello!

Can anyone suggest me how I can solve my problem whish ic as following:

Say I have template

<Book>
        <Title>$book.title</Title>
</Book>

I add Book bean to velocity context

context.put("book", new Book()).

Now if title is null return XML will be:

<Book>
        <Title>$book.title</Title>
</Book>


but I would prefer (empty string):

<Book>
        <Title></Title>
</Book>


Is it possible to do this somewhere in properties or with some kind of 
event?


Regards,
Matjaž

---------------------------------------------------------------------
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