[jboss-user] [JBoss Seam] - Re: EntityConverter - when and how?
irVega
do-not-reply at jboss.com
Sat Mar 31 22:38:29 EDT 2007
OK, so the catbean.categories in
| <h:selectOneMenu value="#{search.category}"
| converter="#{catbean.converter}">
| <f:selectItem itemLabel="Any" itemValue="#{catbean.nullCategory}" />
| <f:selectItems value="#{catbean.categories}" />
| </h:selectOneMenu>
|
returns the map populated in the CategotyBean at instantiation.
When the converter is called into action, it takes the key (the selected Category's name), now in the appropriate context, and looks up the actual Category object (in the same map) to get that Category's id for use in the query.
Is that a better way to achieve this effect than the use of something like an entityQuery for retrieving the Categorys (categoriesQuery) with the following in the components.xml ?
| <h:selectOneListbox <h:selectOneMenu value="#{search.category}"
| <s:selectItems value="#{categoriesQuery.resultList}" var="category" label="#{category.name}" />
| </h:selectOneMenu>
|
Would a converter be needed in this case? What are the pros and cons of each approach (assuming my suggestion would even work - haven't tried it yet)?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033493#4033493
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033493
More information about the jboss-user
mailing list