Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 7th, 2005, 06:07 AM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Regornil
Default upload problem

hey guys..i haf to upload an image file as well as passing some data fields to a jsp.but by setting <enctype="multipart/form-data">..the image can be uploaded..but when request.getParameter for the other fields,the result is null.i haf search around and a lot people r facing tis problem..but seems tt no one has posted an answer to tis.pls help thx ^_______^

Reply With Quote
  #2 (permalink)  
Old March 7th, 2005, 05:16 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I do not think that the command request.getParameter works with the POST method used for passing data from forms, this only works with GET.

You are obviously using the POST method to pass the data to servlet/jsp. I think you will need to parse the other data you want, as you do for the image. Im not sure if there is an easier way, you may find packages that assist with parsing POST data.

Hope this helps.

Reply With Quote
  #3 (permalink)  
Old March 8th, 2005, 12:02 AM
Authorized User
 
Join Date: Mar 2005
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
   angry cat!.the request.getParameter works for both Get and also Post methods.i have done this using both post and get methods for passing datas from forms.it is definitely working.there may something wrong in that program.

bye

Sonnu

Reply With Quote
  #4 (permalink)  
Old March 8th, 2005, 10:01 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If youve used it then I must be wrong, Ill give it ago myself. Cant remember where I read that, sure it was in a Sun tutorial.

Reply With Quote
  #5 (permalink)  
Old March 8th, 2005, 12:13 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Had a look at the tutorial which states:

The getParameter method works well for simple servlets, but if you need to retrieve the POST parameters in the order they were placed on the web page or handle multi-part posts, you can write your own code to parse the input stream.

So you are right POST data can be extracted with getParameter, but the tutorial implies this may not work well with Multipart Request

http://java.sun.com/developer/online...v.html#getpost

Reply With Quote
  #6 (permalink)  
Old March 9th, 2005, 03:12 AM
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Regornil
Default

yes angrycat is right.once u use multipart the data passed is encoded..so using normal request.getParameter will not return u the values of the other fields.aniwae i found a way around it..by uploadin the file on a separate page.thx aniwae.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload File problem khb3283 ASP.NET 2.0 Basics 1 October 3rd, 2008 01:14 PM
upload problem MunishBhatia ASP.NET 2.0 Professional 0 May 4th, 2007 04:32 AM
File upload problem! Ashleek007 Beginning PHP 0 July 15th, 2005 11:08 AM
UpLoad Problem vieritlc Classic ASP Databases 3 May 23rd, 2004 03:42 PM
upload problem.... pls help life_s Ng ASP.NET 1.0 and 1.1 Basics 7 September 16th, 2003 11:20 PM



All times are GMT -4. The time now is 04:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.