0

I'm doing a booking system where you choose an origin and a destination and with that information you look for routes in a table in a database. I have a pojo representing a route, I have a bean called RouteController with getters and setters for a List and the current route.

Getting the list of routes is no problem, but getting one route from the list doesn't work for me, the setter is only setting null and never a route. What am I doing wrong?

<p:selectOneRadio id="grid" value="#{routeController.route}" layout="pageDirection">   
<f:selectItems value="#{routeController.routes}"/>
</p:selectOneRadio>
<p:button id="submitButton" value="Submit" outcome="result.xhtml"/>
user1907859
  • 544
  • 2
  • 5
  • 17
  • [Good basic example](http://stackoverflow.com/questions/6848970/how-to-prepopulate-a-hselectonemenu-from-a-db/) – Omar Nov 06 '13 at 01:07
  • So you basically displaying whole `route` object rather than property in `route` object. It's not a proper Way to handle the situation. End User will see all Objects like `Object@23123`. – SRy Nov 06 '13 at 18:41
  • I have overridden the toString method of the Route class to deal with this. I thought it was convenient because I'm concatenating several of the routes properties. Is this bad practice? – user1907859 Nov 06 '13 at 20:46

1 Answers1

0

Did you try to use converter? Here is demonstrated the example of using it with primefaces: http://www.primefaces.org/showcase/ui/autoCompletePojo.jsf

ppawel
  • 1,046
  • 8
  • 17
  • I do use autocomplete, but I expanded on the "simple" example on that site. It works fine and I have a list of pojos (routes), I just want to select one of them. Am I using selectOneRadio right? – user1907859 Nov 05 '13 at 23:33