permaculture playing cards*
The moose likes Servlets and the fly likes doPost how to get parameters ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doPost how to get parameters ?" Watch "doPost how to get parameters ?" New topic
Author

doPost how to get parameters ?

Milan Djukic
Greenhorn

Joined: Feb 14, 2011
Posts: 27
I have form for upload a picture and 2 input tags.
How to get parameters? request.getParameter("") not working - allways null

But in doGet all is OK. How to solve this?
Valery Lezhebokov
Ranch Hand

Joined: Jun 12, 2006
Posts: 39
It should work. What the getParameterMap() method returns?


SCJP 1.5, OCE EJB 3.x
Milan Djukic
Greenhorn

Joined: Feb 14, 2011
Posts: 27
When i write System.out.println(request.getParameterMap()) i get "{}".

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

getParameter() (and its ilk) does not work when you are using a multi-part form. (I assume you are not using Servlets 3.)

Are you using a file upload package? If so, the documentation for that package should tell you how to get the non-file parameter values. If not, well you should be. File uploading and multi-part forms are too complex to go about re-inventing the wheel.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Milan Djukic
Greenhorn

Joined: Feb 14, 2011
Posts: 27
You'r right. I use org.apache.commom.fileupload and multi-part form

Can you tell me how to get parameters i dont have much time to read documentation
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

But I have time to read it to you?
Milan Djukic
Greenhorn

Joined: Feb 14, 2011
Posts: 27
No, i didnt say to read, but if you know from experience with commons.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

I haven't used it in years. I'd have to look it up just like you.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
If you don't have enough time to even google using apache file upload, find the first link and read the section entitled "Processing the uploaded items", then what are you doing wasting time waiting on this forum?

 
 
subject: doPost how to get parameters ?