Re: File exists
Will Glass-Husain <[email protected]> Thu, 9 Apr 2015 06:06:47 -0700
| Newsgroups | gmane.comp.jakarta.velocity.user |
|---|---|
| Message-ID | <CADDz7ZtVEzF2YZHMUx=bAdvL2x1r=SaV3_KaDJBCgzpDNjNBqQ@mail.gmail.com> |
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, <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>