This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes getting value of cmbbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting value of cmbbox" Watch "getting value of cmbbox" New topic

getting value of cmbbox

Berdy Ahern

Joined: Mar 12, 2005
Posts: 2
Hi there, I'm trying to get the value of the selected item in my comboxbox but I can't do it. I tried .getText but thats not a method of that class. Any help please?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

It's funny that you would use precisely these words:

Originally posted by Berdy Ahern:
I'm trying to get the value of the selected item

... because the method you want is "getSelectedItem()".

Please do yourself a favor and bookmark this page. You can look up any class of interest and quickly find a list of all its methods. Take a few minutes and get familiar with how this documentation is laid out. Learning to use it well is important!

[Jess in Action][AskingGoodQuestions]
It is sorta covered in the JavaRanch Style Guide.
subject: getting value of cmbbox
Similar Threads
how to reset the field after validation using annotations(Struts 2)
Doubt in EL Implicit Objects: Cookie
jsp bean problem
How to convert the for Loop to the equalent JSTL code in JSP
Tricky Question