Results 1 to 4 of 4
- 11-30-2010, 12:45 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 30
- Rep Power
- 0
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.
- 11-30-2010, 01:13 PM #2
Member
- Join Date
- Oct 2010
- Posts
- 32
- Rep Power
- 0
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!
- 11-30-2010, 01:24 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Yep.
Use one of those file upload libraries...and stick the logic in a Servlet, not a JSP.
- 12-01-2010, 06:57 AM #4
Member
- Join Date
- Oct 2009
- Posts
- 30
- Rep Power
- 0
Similar Threads
-
use Servlet submit the form to receive a form for the Chinese but it shows the garble
By dmt198704 in forum Java ServletReplies: 0Last Post: 10-31-2009, 09:24 AM -
want to generate a html form page with dynamic data and submit this form to a url
By vishalkrsrivastava in forum Java AppletsReplies: 10Last Post: 08-12-2009, 04:02 PM -
how can i link html+servlet+xml to form servlet
By balachandarr in forum Java ServletReplies: 0Last Post: 04-15-2009, 04:06 PM -
enctype=multipart/form-data with form data in struts
By vk_satheesh in forum New To JavaReplies: 0Last Post: 09-19-2008, 12:48 PM -
How to read attributes and values in a xml file using servlet
By pragathi_forum in forum Advanced JavaReplies: 1Last Post: 12-18-2007, 05:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks