• Post Reply 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

drop down list doPost() servlet  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 67256
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your drop down list is single select list or multiple select list ?
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ;)
 
Aditya Keyal
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats right Aditya ;)
 
Sakai Bah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, I've sort it out.
 
Oh. Hi guys! Look at this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!