Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting the selected option text  RSS feed

 
Al Razor
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a dropdown (combo box) in the .jsp page of my Liferay portlet, in my Java code I can get the selected value using request.getParameter("DROPDOWN_NAME"); in processAction method.
My question is: how can I get the selected text (the one between the option tags) in the Java code?

Thanks for any help!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. That information is not submitted as part of the request.

If you really need it, you can use JavaScript to copy the value into a hidden input that can be submitted.
 
Al Razor
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You can't. That information is not submitted as part of the request.

If you really need it, you can use JavaScript to copy the value into a hidden input that can be submitted.


Thank you for your answer, Bear!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!