[
https://issues.jboss.org/browse/JBSEAM-4654?page=com.atlassian.jira.plugi...
]
Ciro Cavani edited comment on JBSEAM-4654 at 1/11/11 10:20 AM:
---------------------------------------------------------------
I changed Seam UI code to work with EntityConverter.
Seems to me that there is a bug in 'org.jboss.seam.ui.component.UISelectItems' and
'org.jboss.seam.ui.converter.NoSelectionConverter'. Each one defines a diferent
value for 'NO_SELECTION_VALUE' as 'null' and as
"org.jboss.seam.ui.NoSelectionConverter.noSelectionValue".
I removed the first and imported the second.
With this change, EntityConverter broke because the conversion is based in a position on a
list converted from string value to integer (for a reason that I don't realize, the
value of 'NO_SELECTION_VALUE' is passed to this converter). After some changes
that didn't work, I put a catch for NumberFormatException in method
'org.jboss.seam.ui.EntityIdentifierStore.get'.
(I change method 'org.jboss.seam.ui.converter.NoSelectionConverter.getAsString' to
return NO_SELECTION_VALUE if parameter 'value' is equals to
'NO_SELECTION_VALUE', but I am not sure about that)
I don't know if this is the correct solution, but works for JBoss6.
(To generate a new jar, just change this classes from a seam distribution, and execute
'ant jarui', and pick 'ui/target/jboss-seam-ui.jar')
(I tried change to JSF 1.2, but I couldn't - I am using EAR packaging and the context
parameter didn't work - I didn't dig further)
(I am using the RichFaces jar from its distribution, the jsf2 jar)
Thanks,
was (Author: cavani):
I changed Seam UI code to work with EntityConverter.
Seems to me that there is a bug in 'org.jboss.seam.ui.component.UISelectItems' and
'org.jboss.seam.ui.converter.NoSelectionConverter'. Each one defines a diferent
value for 'NO_SELECTION_VALUE' as 'null' and as
"org.jboss.seam.ui.NoSelectionConverter.noSelectionValue".
I removed the first and imported the second.
With this change, EntityConverter broke because the conversion is based in a position on a
list coverted from string value to integer (for a reason that I don't realize, the
value of 'NO_SELECTION_VALUE' is passed to this converter). After some changes
that didn't work, I put a catch for NumberFormatException in method
'org.jboss.seam.ui.EntityIdentifierStore.get'.
(I change method 'org.jboss.seam.ui.converter.NoSelectionConverter.getAsString' to
return NO_SELECTION_VALUE if parameter 'value' is equals to
'NO_SELECTION_VALUE', but I am not sure about that)
I don't know if this is the correct solution, but works for JBoss6.
(To generate a new jar, just change this classes from a seam distribution, and execute
'ant jarui', and pick 'ui/target/jboss-seam-ui.jar')
(I tried change to JSF 1.2, but I couldn't - I am using EAR packaging and the context
parameter didn't work - I didn't dig further)
(I am using the RichFaces jar from its distribution, the jsf2 jar)
Thanks,
s:selectItems noSelectionLabel does not generate option value
-------------------------------------------------------------
Key: JBSEAM-4654
URL:
https://issues.jboss.org/browse/JBSEAM-4654
Project: Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.2.1.CR1
Environment: JBoss 6 M3
Reporter: Andrew Wheeler
When a selectOneMenu has no items other than the no selection option it does not render
the option value as org.jboss.seam.ui.NoSelectionConverter.noSelectionValue. In this case
the there are no values in person.images.
<h:selectOneMenu id="portrait" value="#{person.portrait}">
<s:selectItems value="#{person.images}" var="i"
label="#{i.annotation}" hideNoSelectionLabel="false"
noSelectionLabel="Select a portrait..."/>
<s:convertEntity/>
</h:selectOneMenu>
This renders:
<select id="person:portraitDecoration:portrait"
name="person:portraitDecoration:portrait" size="1"> <option
selected="selected">Select a portrait...</option>
</select>
The result is that any form submit causes a java.lang.NumberFormatException with message:
"For input string: "Select a portrait...""
I have debugged a little and I can see that the converter is not firing when rendering
the page. It does however fire for other selectOneMenu items on the page that have one or
more items.
A similar and perhaps related issue is referenced in the JBoss Forum.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira