[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1093) s:selectItems noSelectionLabel issue w/JSF 1.2
Stuart Robertson (JIRA)
jira-events at lists.jboss.org
Thu Mar 22 15:41:34 EDT 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-1093?page=comments#action_12357064 ]
Stuart Robertson commented on JBSEAM-1093:
------------------------------------------
Ok, I just spent some time with the debugger.
The scenario where it blows up is when I submit the form with nothing selected in the menu. In the debugger at the point right before the conversion explodes I see the following state in the ConverterChain (forgive the ugly copy/paste from eclipse - though it actually contains the important info I hope):
=======
value "Select search field..."
component HtmlSelectOneMenu (id=15688)
context FacesContextImpl (id=15668)
i$ AbstractList$Itr (id=15693)
converter PrioritizableConverter (id=15692)
_transient false
delegate EnumConverter (id=15695)
priority 2147483647
vb null
this ConverterChain (id=15687)
_transient false
converters ArrayList<E> (id=15696)
elementData Object[2] (id=15697)
modCount 2
size 2
dirty false
=======
The two converters are an EnumConverter and a NoSelectionConverter - which is correct. The problem is that the EnumConverter executes first.
Here's what the chain itself contains:
========
[1] PrioritizableConverter (id=15795)
_transient false
delegate NoSelectionConverter (id=15808)
priority 0
vb null
[0] PrioritizableConverter (id=15692)
_transient false
delegate EnumConverter (id=15695)
priority 2147483647
vb null
========
So it looks like a priority issue? I haven't dug into understanding how the prioritization is assigned, but maybe this is enough to help you understand what's going on.
And just to make sure I'm not leaving out anything important, here's the full table where I'm seeing the issue - the problem appears with the second menu.
Clicking "add" the second time reproduces the symptoms.
========
<rich:panel>
<f:facet name="header">Fine grained criteria</f:facet>
<h:commandLink action="#{itemSearch.addFilterCriteria()}" value="Add a Criteria" />
<br/>
<h:commandLink action="#{itemSearch.clearFilterCriteria()}" value="Remove all Criteria" />
<rich:dataTable value="#{itemFilterCriteria}" var="criteria"
id="itemSearchCriteriaTable">
<h:column>
<f:facet name="header">Field</f:facet>
<h:selectOneMenu value="#{criteria.field}">
<s:selectItems value="#{itemSearch.searchableFields}"
var="field" label="#{field.name}"
noSelectionLabel="Select search field..."
hideNoSelectionLabel="false" />
<s:convertEnum />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">Operation</f:facet>
<h:selectOneMenu value="#{criteria.operation}">
<s:selectItems value="#{itemSearch.operations}" var="operation"
label="#{operation.description}"
noSelectionLabel="Select operation..."
hideNoSelectionLabel="false" />
<s:convertEnum />
</h:selectOneMenu>
</h:column>
<h:column>
<f:facet name="header">Value</f:facet>
<h:inputText styleClass="userControlInput"
value="#{criteria.value}" size="9" />
</h:column>
<h:column>
<f:facet name="header">Remove</f:facet>
<s:link action="#{itemSearch.removeFilterCriteria()}" value="Remove"/>
</h:column>
</rich:dataTable>
</rich:panel>
> s:selectItems noSelectionLabel issue w/JSF 1.2
> ----------------------------------------------
>
> Key: JBSEAM-1093
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1093
> Project: JBoss Seam
> Issue Type: Bug
> Components: JSF
> Affects Versions: 1.2.0.GA
> Environment: Latest Seam version. JSF 1.2, Facelets, JBoss 4.0.5 on OS X 10.4.9.
> Reporter: Stuart Robertson
> Assigned To: Pete Muir
>
> <h:selectOneMenu value="#{criteria.operation}">
> <s:selectItems value="#{itemSearch.operations}" var="operation"
> label="#{operation.description}"
> noSelectionLabel="Select operation..."
> hideNoSelectionLabel="false" />
> <s:convertEnum />
> </h:selectOneMenu>
> produces the following exception:
> Caused by: java.lang.IllegalArgumentException: No enum const class com.fb.core.model.cdm.CdmField.Se
> lect search field...
> at java.lang.Enum.valueOf(Enum.java:192)
> at org.jboss.seam.ui.EnumConverter.getAsObject(EnumConverter.java:16)
> at org.jboss.seam.ui.PrioritizableConverter.getAsObject(PrioritizableConverter.java:61)
> at org.jboss.seam.ui.ConverterChain.getAsObject(ConverterChain.java:103)
> at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRender
> er.java:152)
> at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectOneValue(MenuRenderer.java:197)
> at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:359)
> at javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
> This worked fine before I upgraded to JSF 1.2 (tonight) - though I also upgraded to the latest Seam at the same time.
> The problem is that the noSelectionLabel is being interpreted as a legitimate selection, rather than being, well, an indicator nothing was selected.
> The converter is being asked to convert the noSelection value back into an enum.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list