From: John N. (JIRA) <ji...@st...> - 2011-09-26 14:26:25
|
[ http://www.stripesframework.org/jira/browse/STS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12412#comment-12412 ] John Newman commented on STS-849: --------------------------------- Right.. I forgot we also have: @Override public String toString() { PK id = getID(); return id == null ? super.toString() : id.toString(); } This has been there for a very long time... Try adding that and see if it starts to work. If toString() is being used to drive functionality, I would say that's a bug. > Radio Buttons do not render correctly through the tag using the 'checked' attribute > ----------------------------------------------------------------------------------- > > Key: STS-849 > URL: http://www.stripesframework.org/jira/browse/STS-849 > Project: Stripes > Issue Type: Bug > Components: Tag Library > Affects Versions: Release 1.5.6 > Reporter: Anthony DePalma > Labels: binding, taglib > > I am using a custom population strategy that looks only in the request first and then for values in the tag itself. I've noticed that the checked attribute does not work for radio buttons if the value is a non-primitive object. > For example, using an example Story and Category object: > Story > Long id; > Boolean approved; > Category category; > Category > Long id; > String name ; > The following tags work correctly with the checked attribute preselecting for both radio buttons and checkboxes: > <stripes:checkbox checked="${actionBean.story.approved}" name="story.approved" value="true"/> > <stripes:radio checked="${actionBean.story.approved}" name="story.approved" value="true"/> > However, using a non primitive object such as category, of the following similar tags, only the checkbox tag works correctly: > <stripes:checkbox checked="${actionBean.story.category}" name="story.category" value="${actionBean.healthCategory}"/> > <stripes:radio checked="${actionBean.story.category}" name="story.category" value="${actionBean.healthCategory}"/> > I believe the reason for this is because the checked field in the InputRadioButtonTag.class is declared as a 'String checked' field. The checked attribute in the InputCheckboxTag.class on the other hand uses an 'Object checked' field. In the InputRadioButtonTag, the checked field is stored as the toString value of the object, instead of calling the object's custom converter, so the checked value never matches the value provided in the tag. -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira |