Re: File exists
You’re intentionally constrained in Solr to a specific set of helpers, otherwise a template could cause a security concern. See context objects table here https://cwiki.apache.org/confluence/display/solr/Response+Writers#ResponseWriters-VelocityResponseWriter https://cwiki.apache.org/confluence/display/solr/Response+Writers#ResponseWriters-VelocityResponseWriter If you’re up for some custom Java coding in Solr, you can implement a SearchComponent that you can put into any search request handler that would put something into the response object, say a boolean that tells you if the file exists. If you need to actually read or write to that file, you could do that in the SearchComponent as well. Of course the “FileHelper” idea would work if you hacked the VelocityResponseWriter code (there is a TODO for me in there to make helpers pluggable, but this type of request scares me away from making it too easy! :), but the SearchComponent is a way to get custom data into the response which can then be leveraged by the Velocity template. You can also send in custom request parameters that become part of the request context object as well, in case that helps here. But I’m curious - what’s the need here?It’s a very unusual request for this type of thing, so I’m concerned you’re trying something that should be done a different way instead. — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com http://www.lucidworks.com/ On Apr 9, 2015, at 9:18 AM, phi...@free.fr wrote: Unfortunately, I am using SOLR's implementation of Velocity, and don't know how to create FileHelpers in that context. - Mail original - De: Will Glass-Husain wglasshus...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 9 Avril 2015 15:06:47 Objet: Re: File exists You can't instantiate objects in Velocity for an arbitrary class. remember, Velocity is intended to be a templating, not a scripting language. Create a new class FileHelper which has a method fileExists(string). Pass it into the context in your java code as a reference fileHelper. Then in your template call do $fileHelper.fileExists(/mnt/etc/etc/etc/) WILL On Thu, Apr 9, 2015 at 5:58 AM, phi...@free.fr wrote: Hello, does anyone know how to check if a file exists in Velocity? I have tried: #set ($exists = new File().exists(/mnt/xxxparnex01_pdf/PDF/IHT/${pdf_year_mon_v}/${pdf_day_v}/${pdf_name_page_number}_${pdf_name_page_type}_VIG.jpg) ) to no avail. Cheers, Philippe - 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
Re: $link
If you could show me what you’ve done, I’d be happy to adjust VrW to better suit your needs if that makes sense. Feedback welcome! — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com http://www.lucidworks.com/ On Feb 19, 2015, at 10:16 AM, phi...@free.fr wrote: Hi Erik, thanks for the pointers. I ended up using a combination of Java String methods and $esc.url(). Philippe - Mail original - De: Erik Hatcher erik.hatc...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 19 Février 2015 16:01:12 Objet: Re: $link I love how the Velocity list e-mails end up being about Solr ;) Here are the tools that (Solr 5, a little bit different that previous Solr versions) has these tools: context.put(esc, new EscapeTool()); context.put(date, new ComparisonDateTool()); context.put(list, new ListTool()); context.put(math, new MathTool()); context.put(number, new NumberTool()); context.put(sort, new SortTool()); context.put(display, new DisplayTool()); context.put(resource, new SolrVelocityResourceTool( request.getCore().getSolrConfig().getResourceLoader().getClassLoader(), request.getParams().get(LOCALE))); LinkTool is not wired in. There isn’t really a way to add new tools into the mix without plugging in a new response writer based on Solr’s VelocityResponseWriter (VrW) or overwriting the built-in one. But you probably don’t really need $link, do you? There’s the $esc tool that allows for URL escaping. It’s used to $esc.html() and $esc.url() in the example templates. Happy to help work through this, and even add the LinkTool if you feel it’d be helpful (or work through a way to make tools pluggable in VrW). Erik (author/maintainer of VrW) — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com On Feb 19, 2015, at 9:40 AM, Logan Stinger lstin...@bluelid.com wrote: SOLR uses response writers to convert a SOLR response in to the desired output format. There are various response writers you can use right out of the box and you can control which one is used via command line parameters or via solrconfig.xml file. Ie. wt=xml, wt=json, wt=velocity The VelocityResponseWriter class has a hard coded list of tools that it injects in to the context. I don't know what version of velocity you are using but the link below is the source of the VelocityResponseWriter for version 3.5. I'm sure later versions of this class are similar. I have a custom version of this class in my project that only injects the tools I use/need. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.solr/solr-velocity/3.5.0/org/apache/solr/response/VelocityResponseWriter.java -Original Message- From: phi...@free.fr [mailto:phi...@free.fr] Sent: Thursday, February 19, 2015 8:03 AM To: Velocity Users List Subject: Re: $link Hi, I am using the SOLR version of Velocity, running in Tomcat, which doesn't seem to have a toolbox.xml file. I have manually created such a file, and added it to ...apache-tomcat-8.0.15/webapps/solr/WEB-INF but to no avail. Philippe - Mail original - De: Mike Kienenberger mkien...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 19 Février 2015 14:30:14 Objet: Re: $link Add link to your velocity toolbox.xml file. If you search for keymath/key, you should be able to find the file and then add a new entry for link See LinkTool.html for more information specific to link. http://velocity.apache.org/tools/devel/view/LinkTool.html See config.html for general information on tool configuration. http://velocity.apache.org/tools/releases/2.0/config.html On Thu, Feb 19, 2015 at 5:59 AM, phi...@free.fr wrote: Hi, how do you access $link in velocity templates? I have access to $math, but not link. Many thanks. Philippe - 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 - 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 - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
Re: Functions
You mean like the macros? Since you’re in Solr-land, look at the VM_global_library.vm file and how those pieces are used. (it’s a bit uglier than it should be in the Solr example macro library, but should give you some insight there). — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com http://www.lucidworks.com/ On Feb 19, 2015, at 10:22 AM, phi...@free.fr wrote: Is there a way to create dynamic methods/functions in Velocity Templates? - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
Re: $link
I don’t see any $esc() usage below, so looks like I’m missing the full picture. However, seeing how you’re splitting off pieces of the “url” field in the results display, maybe it’d make sense to script that piecing out of the url at index time instead into separate fields (month, day, year) or in some way massage the incoming data to be what you need in the results? Erik On Feb 19, 2015, at 10:25 AM, phi...@free.fr wrote: Here's the code: - ## e.g., apdf0 in /apdf0/189311/28/003_E_PDF.pdf #set($pdf_dir_v = $list.get($doc.getFirstValue('url').split(/),1)) ## e.g., 189311 #set($pdf_year_mon_v = $list.get($doc.getFirstValue('url').split(/),2)) ## e.g., 28 #set($pdf_day_v = $list.get($doc.getFirstValue('url').split(/),3)) ## e.g., 003_E_PDF.pdf #set($pdf_name_v= $list.get($doc.getFirstValue('url').split(/),4)) ## Generated URL example: http://abc.com:8983/inytapdf0/pdfjs/web/viewer.html?file=../../189009/01/002_E_PDF.pdf#tv=the%20man http://abc.com:8983/inytapdf0/pdfjs/web/viewer.html?file=../../189009/01/002_E_PDF.pdf#tv=the%20man #if ($params.q and $pdf_dir_v and $pdf_year_mon_v and $pdf_day_v and $pdf_name_v) ##set ( $paramsQ = $params.q ) ## Remove double quotes #set ( $temp0 = $params.q.replaceAll(\, ) ) ##temp0 : $temp0 #set ($andIndex = $temp0.indexOf(AND)) #if ($andIndex = 0) ## eg. time in example above #set ($temp2 = $temp0.substring(0, $andIndex)) #else #set ($temp2 = $temp0) #end ##1) temp2 = $temp2 #set ($orIndex = $temp0.indexOf(OR)) #if ($orIndex = 0) ## eg. time in example above #set ($temp2 = $temp0.substring(0, $orIndex)) #else #set ($temp2 = $temp0) #end ##2) temp2 = $temp2 #if ($temp2 and $temp2.length() 0) ##3) temp2 = '$temp2' #set( $viewer_js_url = /${pdf_dir_v}/pdfjs/web/viewer.html?file=../../${pdf_year_mon_v}/${pdf_day_v}/${pdf_name_v}#tv=${temp2} ) #else ## If the user didn't select a search criteria (q), let him view PDF anyway #set( $viewer_js_url = /${pdf_dir_v}/pdfjs/web/viewer.html?file=../../${pdf_year_mon_v}/${pdf_day_v}/${pdf_name_v} ) #end #end --- - Mail original - De: Erik Hatcher erik.hatc...@gmail.com mailto:erik.hatc...@gmail.com À: Velocity Users List user@velocity.apache.org mailto:user@velocity.apache.org Envoyé: Jeudi 19 Février 2015 16:19:25 Objet: Re: $link If you could show me what you’ve done, I’d be happy to adjust VrW to better suit your needs if that makes sense. Feedback welcome! — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com http://www.lucidworks.com/ http://www.lucidworks.com/ http://www.lucidworks.com/ On Feb 19, 2015, at 10:16 AM, phi...@free.fr wrote: Hi Erik, thanks for the pointers. I ended up using a combination of Java String methods and $esc.url(). Philippe - Mail original - De: Erik Hatcher erik.hatc...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 19 Février 2015 16:01:12 Objet: Re: $link I love how the Velocity list e-mails end up being about Solr ;) Here are the tools that (Solr 5, a little bit different that previous Solr versions) has these tools: context.put(esc, new EscapeTool()); context.put(date, new ComparisonDateTool()); context.put(list, new ListTool()); context.put(math, new MathTool()); context.put(number, new NumberTool()); context.put(sort, new SortTool()); context.put(display, new DisplayTool()); context.put(resource, new SolrVelocityResourceTool( request.getCore().getSolrConfig().getResourceLoader().getClassLoader(), request.getParams().get(LOCALE))); LinkTool is not wired in. There isn’t really a way to add new tools into the mix without plugging in a new response writer based on Solr’s VelocityResponseWriter (VrW) or overwriting the built-in one. But you probably don’t really need $link, do you? There’s the $esc tool that allows for URL escaping. It’s used to $esc.html() and $esc.url() in the example templates. Happy to help work through this, and even add the LinkTool if you feel it’d be helpful (or work through a way to make tools pluggable in VrW). Erik (author/maintainer of VrW) — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com On Feb 19, 2015, at 9:40 AM, Logan Stinger lstin...@bluelid.com wrote: SOLR uses response writers to convert a SOLR response in to the desired output format. There are various response writers you can use right out of the box and you can control which one is used via command line parameters or via solrconfig.xml file. Ie. wt=xml, wt=json, wt=velocity The VelocityResponseWriter class
Re: $link
I love how the Velocity list e-mails end up being about Solr ;) Here are the tools that (Solr 5, a little bit different that previous Solr versions) has these tools: context.put(esc, new EscapeTool()); context.put(date, new ComparisonDateTool()); context.put(list, new ListTool()); context.put(math, new MathTool()); context.put(number, new NumberTool()); context.put(sort, new SortTool()); context.put(display, new DisplayTool()); context.put(resource, new SolrVelocityResourceTool( request.getCore().getSolrConfig().getResourceLoader().getClassLoader(), request.getParams().get(LOCALE))); LinkTool is not wired in. There isn’t really a way to add new tools into the mix without plugging in a new response writer based on Solr’s VelocityResponseWriter (VrW) or overwriting the built-in one. But you probably don’t really need $link, do you? There’s the $esc tool that allows for URL escaping. It’s used to $esc.html() and $esc.url() in the example templates. Happy to help work through this, and even add the LinkTool if you feel it’d be helpful (or work through a way to make tools pluggable in VrW). Erik (author/maintainer of VrW) — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com On Feb 19, 2015, at 9:40 AM, Logan Stinger lstin...@bluelid.com wrote: SOLR uses response writers to convert a SOLR response in to the desired output format. There are various response writers you can use right out of the box and you can control which one is used via command line parameters or via solrconfig.xml file. Ie. wt=xml, wt=json, wt=velocity The VelocityResponseWriter class has a hard coded list of tools that it injects in to the context. I don't know what version of velocity you are using but the link below is the source of the VelocityResponseWriter for version 3.5. I'm sure later versions of this class are similar. I have a custom version of this class in my project that only injects the tools I use/need. http://grepcode.com/file/repo1.maven.org/maven2/org.apache.solr/solr-velocity/3.5.0/org/apache/solr/response/VelocityResponseWriter.java -Original Message- From: phi...@free.fr [mailto:phi...@free.fr] Sent: Thursday, February 19, 2015 8:03 AM To: Velocity Users List Subject: Re: $link Hi, I am using the SOLR version of Velocity, running in Tomcat, which doesn't seem to have a toolbox.xml file. I have manually created such a file, and added it to ...apache-tomcat-8.0.15/webapps/solr/WEB-INF but to no avail. Philippe - Mail original - De: Mike Kienenberger mkien...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 19 Février 2015 14:30:14 Objet: Re: $link Add link to your velocity toolbox.xml file. If you search for keymath/key, you should be able to find the file and then add a new entry for link See LinkTool.html for more information specific to link. http://velocity.apache.org/tools/devel/view/LinkTool.html See config.html for general information on tool configuration. http://velocity.apache.org/tools/releases/2.0/config.html On Thu, Feb 19, 2015 at 5:59 AM, phi...@free.fr wrote: Hi, how do you access $link in velocity templates? I have access to $math, but not link. Many thanks. Philippe - 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 - 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 - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
Re: Java classes in SOLR 4.9's Velocity
What are you trying to do? May be best to inquire on the Solr list for this aspect. You can use standard Velocity templating on the objects and tools exposed, and that’s about it. What exactly are your needs? The Solr stuff is documented here, with it being updated for the Solr 5 version (releasing today!), so slightly different from previous versions but not by much: https://cwiki.apache.org/confluence/display/solr/Response+Writers#ResponseWriters-VelocityResponseWriter https://cwiki.apache.org/confluence/display/solr/Response+Writers#ResponseWriters-VelocityResponseWriter — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com http://www.lucidworks.com/ On Feb 19, 2015, at 11:19 AM, phi...@free.fr wrote: Hi, is there a way to use Java classes in SOLR 4.9's Velocity Engine? If so, how? Thanks. Philippe - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
velocimacro.library - all specified required?
I’m trying to set up a system that has some built-in (to a JAR, class path loader) macros defined (in _macros.vm) and allows the user, in their own file system loader path, to define macros.vm (without underscore prefix) to add their own. I’m trying this: engine.setProperty(RuntimeConstants.VM_LIBRARY, _macros.vm,macros.vm”); But I get errors if macros.vm is not found. Can I make it so that velocimacro.library loaded files are optional, such that if macros.vm isn’t there all works fine? It’s giving me an error currently. Also, when given that comma-separated list, are they loaded in that order such that a macro defined in macros.vm can override one in _macros.vm? Thanks for your help! Erik - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
Re: Standalone pages
Philiippe - I just noticed you posted this to the velocity user list. How Solr uses Velocity is perhaps a bit niche/different, so best to ask over on the Solr user list for future questions about the Solr/Velocity integration. But I’m on both lists :) Erik On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote: Hello, I am using currently the Velocity templates that come with the example provided with SOLR, in Tomcat 7. I would like to add a Velocity template called test.vm, in the example/solr/mycollection directory, to display an HTML page containing an image. Unfortunately, the following URL http://myserver:8983/solr/mycollection/test returns a 404 error. http://myserver:8983/solr/mycollection/browse works, though. How does one create standalone Velocity pages, such as test.vm? Many thanks. Philippe - 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
Re: Standalone pages
Interestingly, if you don’t even need to add a template to the server (filesystem) at all with Solr’s VelocityResponseWriter: http://localhost:8983/solr/select?wt=velocityv.template=tv.template.t=template%20from%20thin%20air ;) But even with /browse, you can override bits and pieces (thanks to Velocity’s resource loader trickery) of a template (from thin air): http://localhost:8983/solr/browse?v.template.header=Solritas! And maybe more to your liking, you could leverage /browse as-is, and switch the template, even dynamically (this time you’d save it to the file system or pass the whole template in as a HTTP parameter like above): http://localhost:8983/solr/browse?v.template=test - which will use your test.vm file. Your template gets all the data that is presented in /browse should you choose to render it. While I love hammers, if all you wanted was Velocity “server pages”, Solr’s VelocityResponseWriter admittedly is overkill. *I’d* still do it that way :), but that’s just me (Mr. VrW). However, I’m all for your data being in Solr, and having it be immediately navigable with straightforward Velocity templating is a real treat! Erik On Oct 9, 2014, at 9:13 AM, phi...@free.fr wrote: Hi Erik, thank you for your reply. However, come to think of it, my question is not SOLR-specific. I would like to know if it is possible to create lightweight Web pages with Velocity, in Tomcat, without resorting to servlets, JSP, etc. In other words, can you add a Velocity template to a Tomcat server as easily as you can drop a .php file in an Apache server's DocumentRoot directory. Many thanks. Philippe - Mail original - De: Erik Hatcher erik.hatc...@gmail.com À: Velocity Users List user@velocity.apache.org Envoyé: Jeudi 9 Octobre 2014 14:59:02 Objet: Re: Standalone pages Philiippe - I just noticed you posted this to the velocity user list. How Solr uses Velocity is perhaps a bit niche/different, so best to ask over on the Solr user list for future questions about the Solr/Velocity integration. But I’m on both lists :) Erik On Oct 9, 2014, at 4:19 AM, phi...@free.fr wrote: Hello, I am using currently the Velocity templates that come with the example provided with SOLR, in Tomcat 7. I would like to add a Velocity template called test.vm, in the example/solr/mycollection directory, to display an HTML page containing an image. Unfortunately, the following URL http://myserver:8983/solr/mycollection/test returns a 404 error. http://myserver:8983/solr/mycollection/browse works, though. How does one create standalone Velocity pages, such as test.vm? Many thanks. Philippe - 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 - 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
Re: What does Velocimacro with a Body mean?
One trick I use when confronted with context objects that aren't behaving as I'd expect is to output: $object.class and then it's clear what object type you're dealing with. Erik On Aug 7, 2013, at 18:10 , O. Olson wrote: Thank you very much Sergiu and Alex. I was just about to post to Sergiu that I could not get his suggestion to work, when I saw the post from Alex. Thank you Alex. You are totally correct here – your suggestion worked perfectly and solved my problem. Thanks again to both of you, O. O. - Messaggio originale - Da: Alex Fedotov a...@kayak.com A: Velocity Users List user@velocity.apache.org; O. Olson olson_...@yahoo.it Cc: Nathan Bubna nbu...@gmail.com Inviato: Mercoledì 7 Agosto 2013 16:25 Oggetto: Re: What does Velocimacro with a Body mean? It does not work because bodyContent is an instance of the ASTNode class and not a string, so it does not have the trim method. Use something like this: #macro(my_trim)#set($str=$bodyContent)$str.trim()#end Test: before#@my_trim()-blah- #{end}after Renders: before-blah-after - 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
Re: Wrong evaluation results with velocity 1.6.2
${v.charAt(0)}a.xx should do the trick. When in doubt, surround with curly brackets :) Erik On Sep 19, 2012, at 07:31 , christoff.schm...@finaris.de wrote: Hi, The evaluation of the following Velocity Template produces an invalid output: #set($v = a) $v.charAt(0)a.xxx I would expect aa.xxx as evaluation result, but velocity returns only aa - the dot and the xxx suffix are cut off. If a whitespace is inserted before a.xxx, then the suffix is not cut off. But that solution is not possible for me. Is this a known bug? Is there a fix or work-around for this? Kind regards Christoff Schmitz === Disclaimer The information contained in this e - mail and any attachments ( together the message) is intended for the addressee only and may contain confidential and/or privileged information. If you have received the message by mistake please delete it and notify the sender and do not copy or distribute it or disclose its contents to anyone. FINARIS Financial Software Partner GmbH Sömmerringstr. 23, 60322 Frankfurt/Main, Germany Registered at Frankfurt/Main, HRB 52873 Managing Directors: Dipl. Inf. Hermann Friebel, Dipl. Ing. Kai Bächle, Dipl. Inf. Werner Märkl === - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
dynamic directives
I have a desire to hook when unknown directives are called from a template. The use case is to enable Velocity as a templating engine for JRuby on Rails (and other JRuby'ish things, possibly Sinatra, etc). I've created some code to get part of the way there: http://github.com/erikhatcher/velaro What I'd like to be able to cleanly facilitate is templates that call any of Rails view helper methods, like this: #url_for() where there is no actual implementation of a UrlFor Directive or #macro definition. I'd like to be able to dynamically delegate to any view helpers that Rails is providing, and if not then fall back to standard Velocity handling. I've looked around the 1.6.4 source code a bit and see RuntimeMacro and VelocimacroProxy as some potential leads in how to go about this. But I'm not quite seeing if/how to hook into this capability. Is this possible? If so, any pointers to get me going? Thanks! Erik - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org
Conditional #parse
Hi, I'd like to have some construct like this in a template: #if(templateExists($template)) #parse($template) #end Is there a canonical/approved way of doing this? I've put the VelocityEngine into the context and tried: #if($engine.resourceExists($template)) ... #end But that still throws an exception when $template does not exist. I want to avoid the exception and simply skip #parse'ing if a template does not exist Thanks, Erik - To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org