Hi,

You would think that such a common requirement (file upload) when it comes
to web programming would be supported 'out of the box' ?

Just my two cents.

Thanks,

Stef


----- Original Message -----
From: "Hans Bergsten" <[EMAIL PROTECTED]>
To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 11:41 PM
Subject: Re: Tag for uploading


> Stefan,
>
> > I just got your book on JSP, looks to be the best one on the market
> > BTW.
>
> Ah, you're just saying that to get an answer ;-) Thanks anyway :-)
>
> > I have just skimmed through it and thought I saw something in
> > there where you talk about file upload?  Is that the case or am I
> > missing something.
>
> The only thing I say about file upload in the book is pretty much what
> I said here; I refer to Jason's article about filters. The reason is
> that, like Martin said, file upload really has nothing to do with JSP.
> It's better done using a filter or a servlet.
>
> Hans
>
> > ----- Original Message -----
> > From: "Hans Bergsten" <[EMAIL PROTECTED]>
> > To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 06, 2002 11:30 PM
> > Subject: Re: Tag for uploading
> >
> >
> >
> >>Martin Cooper wrote:
> >>
> >>>[...]
> >>>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! :-)
> >>
> >>An alternative that solves some of the issues Martin describes is to
> >>use a filter, like the file upload filter described in this article
> >>by Jason Hunter:
> >>
> >>
<http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters-p4.html>
> >>
> >>Hans
> >>--
> >>Hans Bergsten [EMAIL PROTECTED]
> >>Gefion Software http://www.gefionsoftware.com
> >>JavaServer Pages http://TheJSPBook.com
> >>
> >>
> >>--
> >>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>
> >
>
> --
> Hans Bergsten [EMAIL PROTECTED]
> Gefion Software http://www.gefionsoftware.com
> JavaServer Pages http://TheJSPBook.com
>
>
> --
> 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