Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do I get request parameters when the form is encoded?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hello,

I have my jsp with enctype="multipart/form-data".when i submit my request, i am unable to get the request parameters in servlet.
How can I get form feild values in servlet ???

Its very urgent plzzzzz anyone help me....

Regards,
Bhavani


[BPSouther: fixed spelling error in subject line]
[ August 14, 2007: Message edited by: Ben Souther ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Here is a code snippet.


HTH.
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have done this before to upload a file and passed it a hidden field,
It worked fine with me.

Can you paste your code so that we can see what can be wrong in it.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Bhavani R Gupta:

Its very urgent plzzzzz anyone help me....



Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see EaseUp to find out why adding 'urgent' to your subject line or post can actually slow down responses to your question or stop them altogether.

Also, please see
UseRealWords
Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
How you read form parameters depends on the library you're using to parse the multipart upload.

Check the documentation for the library you're using.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am using struts for getting the content of uploaded file

My jsp is



My action is:



My form bean is:


Note the bold lines in action and the jsp. I have not used anything struts specific in sending the hidden parameter. I am successfully able to get the value of the dummy hidden parameter.

Can you paste your code so that one can get a close look at it.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I'd be hesitant to offer any specific solutions until we know what upload libraries the original poster is using. If he's using Struts then this isn't the right forum to discuss the issue anyway.

Let's see what he's using before posting anymore code.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Ok, here is the code using jsp and servlets only

The servlet is



The jsp is



Here the hidden parameter is successfully read. So there should not be any problem.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Amol Nayak:
Ok, here is the code using jsp and servlets only

The servlet is



The jsp is



Here the hidden parameter is successfully read. So there should not be any problem.



Request.getParameter() does not work with multipart requests.
Each upload library has its own methods for retrieving form parameters.
This is why I suggested that we wait to see which the original poster is using before posting any more code.
 
Bhavani R Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Sahid Khan:
Here is a code snippet.


HTH.




Thankyou.It is working fine with item.getString()method.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

[ February 21, 2008: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Durga,
Rather than drag out old threads that already have lots of posts, please start a new thread with your new question. Threads with lots of posts tend not to be read; especially if they're old.
 
    Bookmark Topic Watch Topic
  • New Topic