I think you can create an IncludeEventHandler that returns null when the template doesn't exists, which would cause the #parse to be skipped.
On Sun, Apr 25, 2010 at 12:31 AM, bluejoe2008 <bluejoe2...@gmail.com> wrote: > but hello.inc maybe is a relative path > and it is difficult for $templateTool to decide > > 2010-04-25 > > > > bluejoe2008 > > > > 发件人: Jarkko_Viinamäki-2 > 发送时间: 2010-04-25 15:26:25 > 收件人: user > 抄送: > 主题: Re: how to determine the included template file exists or not? > > One option is to write a Java class for checking template existence and put > it in Velocity context as a tool. > #if( $templateTool.exists("hello.inc") ) > #parse("hello.inc") > #end > bluejoe-2 wrote: >> >> how to determine the included template file exists or not? in my .vm >> page, i want to write such codes as follows: >> >> #set($var=$param("fileName")) >> #parse("${var}.inc") >> > -- > View this message in context: > http://old.nabble.com/how-to-determine-the-included-template-file-exists-or-not--tp28354538p28354663.html > Sent from the Velocity - User mailing list archive at Nabble.com. > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org