Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with selectonemenu

 
Rodrigo Ribeiro
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic