[ 
http://www.stripesframework.org/jira/browse/STS-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12411#comment-12411
 ] 

Anthony DePalma commented on STS-849:
-------------------------------------

Yes all of my objects use the same hashcode equals based on the same id that 
the formatter is used to provide.

The problem is that in the radio tag:
<stripes:radio checked="${actionBean.story.category}">
The value that checked resolves to is the toString of the object, when in fact 
it needs to be the string provided by the object's custom typeFormatter.

I verified with a debugger that the value of checked is always the toString for 
radioButtons, but for checkboxes it correctly uses the objects typeFormatter.

Because toString is used, any common primitive object (or object where the 
toString happens to return the correct typeFormatter value) will work fine, as 
I imagine thats how this isn't a problem for many situations. But when the type 
formatter needs to be rendered, it will fail.

> 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

        

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to