• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving a drop-down list value.

 
Jahnavi Kondapaneni
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a HTML form which displays a select drop-down list.I am using the "GET" method.
After the form is submitted I would like to retrieve the value selected in the drop down box within the servlet.
How do I do this?
Thanks in advance.


Regards,
Janu
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use,



 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahnavi if I am not mistaken, you must have done something like this



Now you just have to use request.getParameter("mySelect"); and it will return the value of the selected option. Remember it will not return Servlet or JSP or Struts, it will return the value attribute of the option tag i.e. either 1,2 or 3...
 
Jahnavi Kondapaneni
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys its working fine.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahnavi Kondapaneni wrote:I am using the "GET" method.


why you are using GET to submit the form. always use POST with form
 
Jahnavi Kondapaneni
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Seetharaman,

I did change the method from GET to POST...
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Jahnavi Kondapaneni .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic