tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject Re: FW: checking for files
Date Tue, 12 Mar 2002 15:58:07 GMT
JSTL doesn't currently support explicit file operations, but you can use
<c:import> to test for the existence of files.  There's a new <c:catch>
tag which lets you handle errors -- such as an IOException -- in your
page.  If you write

 <c:catch var="potentialError">
   <c:import ... />
 </c:catch>

you can "speculatively" try to import a file and determine whether it
failed or not.  This does, in many ways, approach the feared "programming
with tags" models, so I don't particularly recommend it for larger
applications; it might be better simply to design a custom tag library
that handles all of your application-specific file-management needs.
But this JSTL-based option is available to you if you find it useful.

--
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this spring from Manning Publications)

On Mon, 11 Mar 2002, Agrawal, Anuj (Anuj)** CTR ** wrote:

> I didn't see any responses to this, so let me try one more time.  Anyone?
> Please?
> 
> >  -----Original Message-----
> > From: 	Agrawal, Anuj (Anuj)** CTR **  
> > Sent:	Friday, March 08, 2002 11:33 PM
> > To:	'Jakarta Tag Libraries Users List'
> > Subject:	checking for files
> > 
> > I'd like to to be able to test if a file (in the particular web context)
> > exists.
> > 
> > e.g. in my webapp, i have an images directory which contains a bunch of
> > jpegs (1.jpg, 2.jpg, etc).  I'd like to programmatically test (using JSTL
> > tags or any other taglib) if a particular file (e.g. 3.jpg) exists.
> > 
> > Is this even possible?
> > Thanks.
> > Anuj.
> > 
> > PS: i know i can do it using scriptlets and File object, but the "problem"
> > is that my values are coming from a database query using JSTL sql actions,
> > and i'm not sure how to get the $row.get('havePic') value into a
> > scriptlet.
> 
> --
> To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message