Apache Commons File Upload in Struts Dispatch Action class (returnsfileItems 0)

Discussion in 'Java' started by sudpri02@gmail.com, Oct 28, 2008.

  1. Guest

    Hi,
    I am using the following form/Struts 1.1 Action class for File Upload
    and I am getting the fileitems as 0. Using Apache Commons File Upload
    to parse the request in the Dispatch Action.


    JSP:
    <form name="merlinUpdatePkgForm" action="/admin/Pkg.do?
    method=fileupload" method="post" enctype="multipart/form-data">
    <input type="file" name="postalTablePath">
    <input type=submit value="Submit">
    </form>



    Struts action Action class:
    ---------------------------

    public class MerlinUpdPkgCommon extends DispatchAction
    {



    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) throws
    Exception
    {

    DiskFileUpload fu = new DiskFileUpload();
    List fileItems = = fu.parseRequest(request);
    logger.info("fileItems"+fileItems.size());
    Iterator itr = fileItems.iterator();

    }


    }


    Any help is appreciated.

    regards
    sudha
    , Oct 28, 2008
    #1
    1. Advertising

  2. Guest

    Re: Apache Commons File Upload in Struts Dispatch Action class(returns fileItems 0)

    On 10ÔÂ29ÈÕ, ÉÏÎç2ʱ04·Ö, "" <> wrote:
    > Hi,
    > I am using the following form/Struts 1.1 Action class for File Upload
    > and I am getting the fileitems as 0. Using Apache Commons File Upload
    > to parse the request in the Dispatch Action.
    >
    > JSP:
    > <form name="merlinUpdatePkgForm" action="/admin/Pkg.do?
    > method=fileupload" method="post" enctype="multipart/form-data">
    > <input type="file" name="postalTablePath">
    > <input type=submit value="Submit">
    > </form>
    >
    > Struts action Action class:
    > ---------------------------
    >
    > public class MerlinUpdPkgCommon extends DispatchAction
    > {
    >
    > public ActionForward execute(ActionMapping mapping, ActionForm form,
    > HttpServletRequest request, HttpServletResponse response) throws
    > Exception
    > {
    >
    > DiskFileUpload fu = new DiskFileUpload();
    > List fileItems = = fu.parseRequest(request);
    > logger.info("fileItems"+fileItems.size());
    > Iterator itr = fileItems.iterator();
    >
    > }
    > }
    >
    > Any help is appreciated.
    >
    > regards
    > sudha


    Hi,I had the same problemn,I think you should try Action.
    , Nov 20, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chase Preuninger

    Apache Commons File Upload

    Chase Preuninger, Jun 6, 2008, in forum: Java
    Replies:
    1
    Views:
    354
    Arne Vajhøj
    Jun 7, 2008
  2. Chase Preuninger

    Apache Commons File Upload Problem

    Chase Preuninger, Jun 14, 2008, in forum: Java
    Replies:
    0
    Views:
    754
    Chase Preuninger
    Jun 14, 2008
  3. Replies:
    0
    Views:
    305
  4. Replies:
    0
    Views:
    299
  5. pinik
    Replies:
    0
    Views:
    282
    pinik
    Oct 28, 2008
Loading...

Share This Page