You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Azùa Giovanni (KSXK 12)" <gi...@credit-suisse.com> on 2010/10/06 12:06:59 UTC

automatic fill of unspecified placeholders?

Hello,

I have a large template with many placeholders. According to some rules, the application populates several of these attributes to the context and leave some unspecified. I would like that the unspecified ones ( i.e. velocityContext.get("placeholderA") == null ) become empty Strings "" ... I researched the Velocity API but could not find any provision for this use-case something like callback if unspecified.

Can anyone point me to the way to achieve this with Velocity?

TIA,
Best regards,
Giovanni

==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
============================================================================== 


RE: automatic fill of unspecified placeholders?

Posted by "Azùa Giovanni (KSXK 12)" <gi...@credit-suisse.com>.
Ciao Antonio,

Awesome! this is exactly what I was looking for but could not find the match from problem description => feature name in google ;)

Saluti!
Giovanni

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Wednesday, October 06, 2010 12:31 PM
To: Velocity Users List
Subject: Re: automatic fill of unspecified placeholders?

2010/10/6 Azùa Giovanni (KSXK 12) <gi...@credit-suisse.com>:
> I have a large template with many placeholders. According to some rules, the application populates several of these attributes to the context and leave some unspecified. I would like that the unspecified ones ( i.e. velocityContext.get("placeholderA") == null ) become empty Strings "" ... I researched the Velocity API but could not find any provision for this use-case something like callback if unspecified.
>
> Can anyone point me to the way to achieve this with Velocity?

Wouldn't it be easier with the quiet reference notation?
http://velocity.apache.org/engine/releases/velocity-1.6.4/user-guide.html#quietreferencenotation

Antonio

---------------------------------------------------------------------
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: automatic fill of unspecified placeholders?

Posted by Antonio Petrelli <an...@gmail.com>.
2010/10/6 Azùa Giovanni (KSXK 12) <gi...@credit-suisse.com>:
> I have a large template with many placeholders. According to some rules, the application populates several of these attributes to the context and leave some unspecified. I would like that the unspecified ones ( i.e. velocityContext.get("placeholderA") == null ) become empty Strings "" ... I researched the Velocity API but could not find any provision for this use-case something like callback if unspecified.
>
> Can anyone point me to the way to achieve this with Velocity?

Wouldn't it be easier with the quiet reference notation?
http://velocity.apache.org/engine/releases/velocity-1.6.4/user-guide.html#quietreferencenotation

Antonio

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