File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 15286
    
    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 - A Test Data Generation Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with selectonemenu
 
Similar Threads
Null first value in a SelectOneMenu
Facing Problem in JSF form SelectItem[]
selectOneMenu label value
selectOneMenu
Problem With selectOneMenu