You could create a java File object for and then use an if tag to decide what 
to display.

In you action class ...


public File getFile(){
        // returns the file list
}

In your template ...


<s:url var=imgUrl value="yourOtherImageFile" />
<s:if test="%{file.exists()}">
        <s:url var=imgUrl value="yourImageFile" />
</s:if>
<img href="<s:property value="#imgUrl"/>" />



-----Original Message-----
From: Leonidas Papadakis [mailto:[EMAIL PROTECTED]
Sent: September 20, 2007 4:20 PM
To: Struts Users Mailing List
Subject: check if file exists...

Hi there,

does anyone know in struts2 whether i can test if a file exists from my
template file i.e.

if fileExists(folder/image1) then ... show image1 else show image2

Thanks in advance

Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


********************
NOTICE OF CONFIDENTIALITY
This communication including any information transmitted with it is 
intended only for the use of the addressees and is confidential. 
If you are not an intended recipient or responsible for delivering 
the message to an intended recipient, any review, disclosure, 
conversion to hard copy, dissemination, reproduction or other use 
of any part of this communication is strictly prohibited, as is the 
taking or omitting of any action in reliance upon this communication. 
If you receive this communication in error or without authorization 
please notify us immediately by return e-mail or otherwise and 
permanently delete the entire communication from any computer, 
disk drive, or other storage medium.

If the above disclaimer is not properly readable, it can be found at 
www.td.com/legal
                                                           
AVERTISSEMENT DE CONFIDENTIALITE                   
Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement 
aux destinataires susmentionnés,  est confidentiel.  Si vous 
n’êtes pas le destinataire prévu ou un agent responsable de la 
livraison de ce courriel, tout examen, divulgation, copie, impression, 
reproduction, distribution, ou autre utilisation d’une partie de ce 
courriel est strictement interdit de même que toute intervention ou 
abstraction à cet égard.  Si vous avez reçu ce message par erreur ou 
sans autorisation, veuillez en aviser immédiatement l’expéditeur par 
retour de courriel ou par un autre moyen et supprimer immédiatement 
cette communication entière de tout système électronique.

Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous 
pouvez le consulter à www.td.com/francais/legale

Reply via email to