Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Java » JSF
Bookmark "Problems with selectonemenu " Watch "Problems with selectonemenu " New topic

Problems with selectonemenu

Rodrigo Ribeiro

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="#{}">
<f:selectItems value="#{sale.carList}" />

car list is loaded on a code similar to this:

while ({
Car car = new Car();
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: 15302

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:
subject: Problems with selectonemenu
It's not a secret anymore!