Results 1 to 4 of 4
  1. #1
    jason.3dmagic is offline Member
    Join Date
    Oct 2009
    Posts
    30
    Rep Power
    0

    Exclamation Get session attributes in servlet while using multiplart/form-data tag is JSP

    Hi,
    I am trying to upload a file onto some location and the logic for the same is working fine. i.e the file is getting uploaded.
    I have two JSP files one where i have browse button and other with the upload logic. When I click on browse and select the file to be uploaded and submit the request, the file gets uploaded but I am not able to get the session attributes of previous JSP in the new JSP by writing request.getParameter("first"); It is returning null.

  2. #2
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default thats so obvious!

    Obviously request.getParameter will return null. when u use enctype="multipart/form-data", the content is transmitted as a MIME stream. Request.getParameter doesn't work with MIME streams. Either u upload the file in a separate form, or use apache's/OReily's file upload library, bcoz its very very tough to xtract datas from boundaries.

    For more details, search this forum, u'll get a lot of post on uploading file!

    good luck!

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Yep.
    Use one of those file upload libraries...and stick the logic in a Servlet, not a JSP.

  4. #4
    jason.3dmagic is offline Member
    Join Date
    Oct 2009
    Posts
    30
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 10-31-2009, 09:24 AM
  2. Replies: 10
    Last Post: 08-12-2009, 04:02 PM
  3. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  4. enctype=multipart/form-data with form data in struts
    By vk_satheesh in forum New To Java
    Replies: 0
    Last Post: 09-19-2008, 12:48 PM
  5. How to read attributes and values in a xml file using servlet
    By pragathi_forum in forum Advanced Java
    Replies: 1
    Last Post: 12-18-2007, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •