[jboss-user] [JBoss Seam] - selectOneMenu with s:convertEntity and noSelectionLabel does
hurzeler
do-not-reply at jboss.com
Thu May 24 22:28:12 EDT 2007
Hello there,
I got a simple menu using
| <ice:selectOneMenu id="#{messages['region']}" styleClass="selectTagMenu" value="#{siteList.selectedRegion}"
| partialSubmit="true">
| <s:selectItems value="#{regions.resultList}" var="region"
| label="#{region.name}" noSelectionLabel="Select..."/>
| <s:convertEntity />
| </ice:selectOneMenu>
| <ice:commandButton value="#{messages['reset']}"
| action="#{siteList.reset}" /
|
This is all wonderful and the list is displayed. However if I don't select anything (as it is optional) and click the command button the value of the selectOneMenu is "Select..." and the EntityConverter gets confused in
| public Object getAsObject(FacesContext facesContext, UIComponent cmp, String value) throws ConverterException
| {
| if (value == null)
| {
| return null;
| }
| Integer key = new Integer(value);
| Class clazz = EntityConverterStore.instance().getClass(key);
| Object id = EntityConverterStore.instance().getId(key);
| return loadEntityFromPersistenceContext(clazz, id);
| }
|
the value is a string and not null. Hence new Integer(value) fails.
Am I missing something or is there an easy fix short from not using entities directly or leaving out the noSelectionLabel?
Your help is appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048535#4048535
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048535
More information about the jboss-user
mailing list