You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by bluejoe <bl...@sdb.cnic.cn> on 2008/09/27 03:54:55 UTC

can I let Velocity keep silent just through configuration?

Hi All,

 

When Velocity occurs:

 

${a.b}

 

if a is null, it will be rendered as "${a.b}"

 

I know the way "Quiet Reference Notation":

 

$!{a.b}

 

but i hope our developers keep using "${a.b}", in spite that null pointer appears or not, so, can I let Velocity keep silent just through configuration, such as:

 

Velocity.setProperty("quietReference", true);

 

I don't know if Velocity-1.6 supports this or not, and am eager to know the best solution.

 

Regards,

bluejoe

Re: can I let Velocity keep silent just through configuration?

Posted by Claude Brisson <cl...@renegat.net>.
You can set up an InvalidReferenceEventHandler, see
http://velocity.apache.org/engine/releases/velocity-1.5/developer-guide.html#configuring_event_handlers

  Claude

Le samedi 27 septembre 2008 à 09:54 +0800, bluejoe a écrit :
> Hi All,
> 
>  
> 
> When Velocity occurs:
> 
>  
> 
> ${a.b}
> 
>  
> 
> if a is null, it will be rendered as "${a.b}"
> 
>  
> 
> I know the way "Quiet Reference Notation":
> 
>  
> 
> $!{a.b}
> 
>  
> 
> but i hope our developers keep using "${a.b}", in spite that null pointer appears or not, so, can I let Velocity keep silent just through configuration, such as:
> 
>  
> 
> Velocity.setProperty("quietReference", true);
> 
>  
> 
> I don't know if Velocity-1.6 supports this or not, and am eager to know the best solution.
> 
>  
> 
> Regards,
> 
> bluejoe


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