> -----Original Message-----
> From: Pierre Delisle [mailto:pierre.delisle@;sun.com]
> Sent: Wednesday, November 06, 2002 5:06 PM
> To: Tag Libraries Users List
> Subject: Re: Tag for uploading
> 
> 
> 
> 
> Stefan wrote:
> ...
> > Is there a tag for uploading of files in JSTL?
> 
> No. 
> 
> You may want to check the <html:file> tag in struts.

The Struts <html:file> tag generates an HTML <input type="file"> element,
and doesn't actually handle the request. If the latter is what you are
looking for, I'm not sure how feasible that really is in a JSP page.

The issue is that parsing a multipart request consumes the input stream, so
you can only do that once. Some containers (e.g. Resin) have built-in
multipart handling, and if that's enabled, it should provide all you need.
But your pages will have to "know" that the container did that, and have to
"know" how to access the uploaded files. That's not portable.

If your container doesn't support multipart handling, or you've disabled it,
then you might be able to wrap a tag around a package such as Commons
FileUpload:

http://jakarta.apache.org/commons/fileupload/

The main issue with this is how you would access non-file parameter values
in the rest of the JSP page. Calls to request.getParameter() (either direct
or indirect, using tags) after parsing the multipart request will not work,
since FileUpload will have "stolen" the parameters. You'd have to obtain the
values directly from the FileUpload instance, since there is no way to tell
the container about the parameters (short of creating your own JSP page base
class and wrapping the request, but that's getting even more far fetched!
:).

In short - use a servlet! :-)

--
Martin Cooper


> 
>     -- Pierre
> 
> 
> --
> 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>

Reply via email to