[ 
https://issues.apache.org/struts/browse/WW-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46316#action_46316
 ] 

Wes Wannemacher commented on WW-3120:
-------------------------------------

Jeff, sorry after reading my comment, I realized I didn't explain... The 
Checkbox interceptor loops through all the parameters in the context and if it 
finds one that is associated with a checkbox, it removes the parameter from the 
map and then jimmies a boolean in there. I can see where you're coming from 
because it makes for a special case and definitely unintuitive behavior. I just 
don't want to try to change existing behavior while I'm working on a minor 
release. I wouldn't have a problem fixing it in a later release, especially if 
removing checkbox is troublesome. 

> <s: checkbox> returns boolean type to ParameterAware
> ----------------------------------------------------
>
>                 Key: WW-3120
>                 URL: https://issues.apache.org/struts/browse/WW-3120
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.11.1
>         Environment: Windows XP SP3, IE6 & Firefox 3.0.10, Apache Tomcat 
> 5.5.17, Java 1.5.0_15
>            Reporter: Jeff Kelley
>            Assignee: Wes Wannemacher
>             Fix For: 2.1.7
>
>
> My action class is implementing ParameterAware so I can get all the 
> name/value pairs on the page. When using the <s:checkbox> tag the value is a 
> boolean in the ParameterMap, not a String[].
> JSP:
> <s:checkbox name="MCN"  fieldValue="true" theme="simple"/>
> Action Class:
> public class Upload extends ActionSupport implements SessionAware, 
> ParameterAware
> {
>      private Map<String, String[]> parameterMap;
>      public String execute()
>      {
>         String[] stuff;
>         stuff = parameterMap.get("MCN");
>         return SUCCESS;
>      }
>      public void setParameters(Map paramMap)
>     {
>         parameterMap = paramMap;
>     }
> }
> When the execute() method runs I get a class cast exception on 'stuff' since 
> it cannot cast from a boolean to a String[].
> When I debug the remote JVM with Eclipse 3.4 I get the following in the 
> parameterMap : {password=[Ljava.lang.String;@1e6ee98, 
> struts.token.name=[Ljava.lang.String;@3a3e21, MCN=false, 
> struts.token=[Ljava.lang.String;@9ac272, uID=[Ljava.lang.String;@1c519e2}.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to