velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@free.fr
Subject Re: File exists
Date Thu, 09 Apr 2015 13:18:11 GMT
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" <wglasshusain@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, <phiroc@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-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message