[
https://issues.apache.org/jira/browse/MYFACES-4169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16238236#comment-16238236
]
Eduardo Breijo edited comment on MYFACES-4169 at 11/3/17 7:49 PM:
------------------------------------------------------------------
I have better identified the issues. I'm not completely sure if they are valid
cases.
Issue #1
When ID does not contain a number at the end:
<h:selectOneRadio id="radioOther" group="group2"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
Rendered markup has the same id:
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue1" /><label for=""> staticValue1</label>
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue2" /><label for=""> staticValue2</label>
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue3" /><label for=""> staticValue3</label>
Issue #2
When ID contains a number at end that it is greater than the number of
selectItems, an IndexOutOfBound exception is thrown.
java.lang.IndexOutOfBoundsException: Index: 8, Size: 3
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.myfaces.shared.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:166)
at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:675)
at
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:555)
at
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551)
Issue #3
When ID contains a number at the end, and that number is not 0, for example
“radio1”, it will select the second item in the list, instead of starting from
the first.
<h:selectOneRadio id="radio1" group="group1"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
<h:selectOneRadio id="radio2" group="group1"/>
Rendered markup:
<input id="form1:radio1" type="radio" name="form1:group1"
value="form1:radio1:staticValue2" /><label for=""> staticValue2</label>
<input id="form1:radio2" type="radio" name="form1:group1"
value="form1:radio2:staticValue3"><label for=""> staticValue3</label>
Issue #4
When you start the selectOneRadio with an ID that ends with a number, but then
the next selectOneRadio doesn’t contain the next number in sequence, and they
are part of the same group. Only the first one is rendered.
<h:selectOneRadio id="radio0” group="group1"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
<h:selectOneRadio id="radio1A" group="group1"/>
<h:selectOneRadio id="radio1B" group="group1"/>
Rendered markup:
<input id="form1:radio0" type="radio" name="form1:group1"
value="form1:radio0:staticValue1"><label for=""> staticValue1</label>
I think there should not any difference when the ID ends with a number or ends
with a letter. This should work the same regardless.
was (Author: eduardobreijo):
I have better identified the issues. I'm not completely sure if they are valid
cases.
Issue #1
When ID does not contain a number at the end:
<h:selectOneRadio id="radioOther" group="group2"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
Rendered markup has the same id:
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue1" /><label for=""> staticValue1</label>
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue2" /><label for=""> staticValue2</label>
<input id="form1:radioOther" type="radio" name="form1:group2"
value="form1:radioOther:staticValue3" /><label for=""> staticValue3</label>
Issue #2
When ID contains a number at end that it is greater than the number of
selectItems, an IndexOutOfBound exception is thrown.
java.lang.IndexOutOfBoundsException: Index: 8, Size: 3
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at
org.apache.myfaces.shared.renderkit.html.HtmlRadioRendererBase.encodeEnd(HtmlRadioRendererBase.java:166)
at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:675)
at
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:555)
at
javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551)
Issue #3
When ID contains a number at the end, and that number is not 0, for example
“radio1”, it will select the second item in the list, instead of starting from
the first.
<h:selectOneRadio id="radio1" group="group1"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
<h:selectOneRadio id="radio2" group="group1"/>
Rendered markup:
<input id="form1:radio1" type="radio" name="form1:group1"
value="form1:radio1:staticValue2" /><label for=""> staticValue2</label>
<input id="form1:radio2" type="radio" name="form1:group1"
value="form1:radio2:staticValue3"><label for=""> staticValue3</label>
Issue #4
When you start the selectOneRadio with an ID that ends with a number, but then
the next selectOneRadio doesn’t contain the next number in sequence, and they
are part of the same group. Only the first one is rendered.
<h:selectOneRadio id="radio0” group="group1"
value="#{selectOneRadioGroupBean.selectedValue}">
<f:selectItem itemValue="staticValue1"/>
<f:selectItem itemValue="staticValue2"/>
<f:selectItem itemValue="staticValue3"/>
</h:selectOneRadio>
<h:selectOneRadio id="radio1A" group="group1"/>
<h:selectOneRadio id="radio1B" group="group1"/>
Rendered markup:
<input id="form1:radio0" type="radio" name="form1:group1"
value="form1:radio0:staticValue1"><label for=""> staticValue1</label>
> selectOneRadio does not work properly in JSF 2.3
> ------------------------------------------------
>
> Key: MYFACES-4169
> URL: https://issues.apache.org/jira/browse/MYFACES-4169
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-372
> Affects Versions: 2.3.0-beta
> Reporter: Paul Nicolucci
> Priority: Major
> Attachments: JSF23SelectOneRadioGroup.war
>
>
> I was testing out the new group attribute on the <h:selectOneRadio/>
> component and found that it does not look to work in all scenarios:
> I've provided a test application to shows a working scenario and then
> multiple scenarios that I think should work but don't.
> The app can be deployed on tomcat.
> You can drive a request to the index page which will contain the links what
> doesn't work:
> http://localhost:8080/JSF23SelectOneRadioGroup/index.xhtml
> Or you can directly verify what does not work by sending requests to:
> localhost:8080/JSF23SelectOneRadioGroup/error.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error2.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error3.xhtml
> localhost:8080/JSF23SelectOneRadioGroup/error4.xhtml
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)