This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Problems with selectonemenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problems with selectonemenu " Watch "Problems with selectonemenu " New topic
Author

Problems with selectonemenu

Rodrigo Ribeiro
Greenhorn

Joined: Aug 14, 2006
Posts: 1
I've been trying to get selectonemenu to work but no success so far.

I have a "sale" and a "car" bean, and car is an atribute for sale. All the classe are very simple and clear, with all thet gets and sets on the spot.

On my "New sale" jsp I display all the car options on a selectonemeu. So far so good...all the cars show on the jsp.

But, when I click submmit, I get a validation error....saying it can't convert the value to a null converter.

The jsp fragment:

<h:selectOneMenu id="menuanalista" value="#{sale.car}">
<f:selectItems value="#{sale.carList}" />
</h:selectOneMenu>

car list is loaded on a code similar to this:

while (rs.next()){
Car car = new Car();
car.setModel(rs.getString("model"));
......
this.getCarList().add(new SelectItem(car,car.getModel()));
}

I tried using a converter, but no succes....

Any help is welcome.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

this.getCarList().add(new SelectItem(car,car.getModel()));

If your car object had a toString() method that might work. But since it doesn't you'll need to specify something a bit more precise like car.getId() or something that can go into the value parameter of the option tag.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with selectonemenu
 
Similar Threads
Problem With selectOneMenu
selectOneMenu label value
Facing Problem in JSF form SelectItem[]
selectOneMenu
Null first value in a SelectOneMenu