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