IBM Portal / WCM Forum

Free community discussion board for IBM® WebSphere® Portal
and Lotus Web Content Management™
(WCM / ILWWCM / LWWCM / WWCM) products.

You are not logged in.

Announcement

#1 2010-05-18 6:08 pm

janey06
Newbie
Registered: 2009-12-22
Posts: 2

access multipart/form-data via jsp component

Hi!
I created an HTML component which contains a form, and references a jsp component.
The form contains text fields and a file upload field.  The JSP component process the submitted data.
The JSP can read the submitted data if the enctype is not multipart/form-data.
But if I changed the enctype to multipart/form-data the request.getInputStream() doesn't contain anything.
Here's a snippet of the code:

        InputStream input = request.getInputStream();
       
        if (input != null) {
            BufferedInputStream bis = new BufferedInputStream(input);
            ByteArrayOutputStream buf = new ByteArrayOutputStream();
            int result = bis.read();
            while(result != -1) {
                byte b = (byte)result;
                buf.write(b);
                result = bis.read();
            }       
            out.println("content: " + buf.toString() + "<br />");
        }

bis.read always return -1.

Please help.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

* IBM and Workplace Web Content Management are trademarks of International Business Machines Corporation in the United States, other countries, or both.

This website is not run by IBM® - it is a privately owned and run website for the benefit of the Portal and WCM community.