Best way to handle optional attributes in 1.6.2

2009-06-13 Thread sebb
I'm generating HTML using a Velocity style sheet with version 1.6.2 The source contains lots of elements which are used to generate table cell entries: Description The "required" attribute is supposed to be "Yes" or "No", with a default of "No". The VSL currently has: #if($items.getAttributeV

Re: Best way to handle optional attributes in 1.6.2

2009-06-13 Thread Jude Robinson
> Is there a better way to handle optional attributes? "!$items.getAttributeValue('required')" != "" - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org

Resource from a jar file

2009-06-13 Thread Mark Fenbers
I'm having some trouble with mergeTemplate() in that it seems to be unable to open a template file if it is packaged in a jar file. In my Java code, I use getResource("resources/velocity.template").getFile() [from the "Class" object] to expand the relative location to a full URL. This is for

Re: Best way to handle optional attributes in 1.6.2

2009-06-13 Thread Nathan Bubna
That should be: #if( "$!items.getAttributeValue('required')" != "" ) Or just $!items.getAttributeValue('required') if you don't mind showing empty strings. Or if you really want to clean up the look: public class AltTool { public Object empty(Object val, Object alt) { return (val == null

Re: Resource from a jar file

2009-06-13 Thread Nathan Bubna
I think org.apache.velocity.runtime.resource.loader.JarResourceLoader was created to help with such situations. On Sat, Jun 13, 2009 at 4:56 PM, Mark Fenbers wrote: > I'm having some trouble with mergeTemplate() in that it seems to be unable > to open a template file if it is packaged in a jar fil

RE: Facing issues with PagerTool

2009-06-13 Thread Maruthi srinivas Marpaka
Thanks Nathan, Sorry for delay in replying. Showcase.war helped me to get what I need. Appreciate your help. Regards Maruthi > Date: Fri, 15 May 2009 09:26:31 -0700 > Subject: Re: Facing issues with PagerTool > From: nbu...@gmail.com > To: user@velocity.apache.org > > $link is an

Re: Resource from a jar file

2009-06-13 Thread Mark Fenbers
Nathan Bubna wrote: I think org.apache.velocity.runtime.resource.loader.JarResourceLoader was created to help with such situations. OK, I read up on JarResourceLoader() and put the appropriate resource loader entries into the velocity.properties file, but now I have a new problem in that if

Re: Resource from a jar file

2009-06-13 Thread Nathan Bubna
On Sat, Jun 13, 2009 at 6:48 PM, Mark Fenbers wrote: > Nathan Bubna wrote: >> >> I think org.apache.velocity.runtime.resource.loader.JarResourceLoader >> was created to help with such situations. >> >> > > OK, I read up on JarResourceLoader() and put the appropriate resource loader > entries into t