[ https://issues.apache.org/struts/browse/WW-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jeff Kelley updated WW-3120:
----------------------------
Description:
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}.
was:
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;
workorderUpload = parameterMap.get("MCN");
return SUCCESS;
}
public void setParameters(Map paramMap)
{
parameterMap = paramMap;
}
}
When the execute() method runs I get a class cast exception 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}.
> <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
>
> 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.
|