Servlet getting multipart parameters problem using Apache FileUpload

Hi

I have a HTML form generated using JavaMail and send to Notes email user who will fill in some information and select file to upload. Therefore it will be a multipart/form-data HTML form. The HTML form will invoke a servlet running in a Tomcat server which performs the file upload using Apache Commons FileUpload . However no parameter could be retrieved using the ServletFileUpload in the servlet, i.e, FileItemIterator has no next element. But if I copied and invoke the HTML form using web browser and call the servlet, it will run successfully.

On the other hand, if it is not a multipart/form-data HTML form, the servlet could retrieve the parameters normally using getParameter method when submitting the HTML forms within the Notes email.

Is there any settings or special procedure required in order to pass the parameters to the servlet for multipart request under Notes email?

Many Thanks for any help or idea.

Subject: Servlet getting multipart parameters problem using Apache FileUpload

For more info, the code in the servlet reading the parameters is as follows:

    boolean isMultipart = ServletFileUpload.isMultipartContent(req);

    String decision = null;

    String file1 = null;

    String file2 = null;

    

            

    try {            

        

        //PrintWriter out = resp.getWriter();            

        ServletOutputStream out = resp.getOutputStream(); 

        resp.setContentType("text/plain; charset=UTF-8");             



        out.println("Processing Result:");

        out.println();

        

        if (isMultipart) {

            out.println("Is multiplart request...");

            

            // Create a new file upload handler

            ServletFileUpload upload = new ServletFileUpload();



            // Parse the request

            FileItemIterator it = upload.getItemIterator(req);

             while (it.hasNext()) {

                FileItemStream item = (FileItemStream) it.next();

                //FileItem item = (FileItem) it.next();

                String name = item.getFieldName();

                InputStream stream = item.openStream();

                //InputStream stream = item.getInputStream();

                if (item.isFormField()) {

                    out.println("Form field " + name + " with value " + Streams.asString(stream) + " detected.");

                } else {

                    out.println("File field " + name + " with file name " + item.getName() + " detected.");

            }