GeeCON Prague 2014*
The moose likes Servlets and the fly likes drop down list doPost() servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "drop down list doPost() servlet" Watch "drop down list doPost() servlet" New topic
Author

drop down list doPost() servlet

Sakai Bah
Greenhorn

Joined: Dec 08, 2009
Posts: 2
Can someone assist me HOW to invoke drop down menu list in doPost() servlet?
Upon selecting and clicking a submit button, the doPost will be invoked, and will appear.

Let say we have this code in eg;
===============================================================================================

index.jsp


Feedback.java

===============================================================================================

I tried using reqest.getParameters but it gives me null as displayed.
How can i have the selected value (Or even multiply values) still displayed?

Thanks and regards
Sakai
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
You want to get the multiple values of the drop down if I gather rightly from your post. For that use request. getParameterValues() to get all the selected values. The return type of the getParameterValues() is a String array.


- Aditya Webservices Blog
swapnl patil
Ranch Hand

Joined: Aug 13, 2007
Posts: 80
Your drop down list is single select list or multiple select list ?
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
below is what you expect




when multiple values are selected then HTML will send all the selected value with the same NAME, so you will get all the element which are selected...

Hope this may helped you ;)


My Thoughts : http://passion4java.blogspot.com
Try not to become a man of success but rather to become a man of value.
Aditya Keyal
Ranch Hand

Joined: Dec 01, 2008
Posts: 71
One more small point that even I had overlooked. HTML and request parameters are case-sensitive. Your JSP reads Feedback whereas you are retrieving feedback. That is the reason why you are getting null value.

Other than that use the code mentioned above by Yousuf (with the case sensitive factor taken into consideration) and it should work.

Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
thats right Aditya ;)
Sakai Bah
Greenhorn

Joined: Dec 08, 2009
Posts: 2
Thanks guys, I've sort it out.
 
GeeCON Prague 2014
 
subject: drop down list doPost() servlet