You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Holmes (JIRA)" <ji...@apache.org> on 2007/10/03 15:24:37 UTC
[jira] Updated: (WW-2218) Parameters binding mismatch
[ https://issues.apache.org/struts/browse/WW-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Holmes updated WW-2218:
-----------------------------
Fix Version/s: 2.0.12
> Parameters binding mismatch
> ---------------------------
>
> Key: WW-2218
> URL: https://issues.apache.org/struts/browse/WW-2218
> Project: Struts 2
> Issue Type: Bug
> Components: Value Stack
> Affects Versions: 2.0.9
> Reporter: Vladimir A. Balandin
> Fix For: 2.0.12
>
>
> Parameters binding don't work properly in case:
> interface SomeInterface<T extends Serializable> {
> void setValue(T value);
> T getValue();
> }
> class SomeAction implements SomeInterface<Integer>{
> Integer value;
> void setValue(Integer value) {
> this.value = value;
> }
> Integer getValue() {
> return value;
> }
> public String execute() {
> System.out.println("value: " + value);
> return "success";
> }
> }
> Attribute "value" which posted from form would be null always.
> Other example:
> import ognl.Ognl;
> import ognl.OgnlContext;
> import com.opensymphony.xwork2.util.OgnlValueStack;
> import java.io.Serializable;
> public class OGNLDebug {
> public static void main(String[] argv) {
> Result result = new Result();
> OgnlValueStack stack = new OgnlValueStack();
> stack.push(result);
> stack.setValue("example.param", "0");
> stack.setValue("brokenExample.param", "0");
> System.out.println("example.param: " + result.getExample().getParam() );
> System.out.println("brokenExample.param: " + result.getBrokenExample().getParam() );
> }
> }
> class Result {
> private Example example = new Example();
> private BrokenExample brokenExample = new BrokenExample();
> public Result() {
> }
> public Example getExample() {
> return example;
> }
> public void setExample(Example example) {
> this.example = example;
> }
> public BrokenExample getBrokenExample() {
> return brokenExample;
> }
> public void setBrokenExample(BrokenExample brokenExample) {
> this.brokenExample = brokenExample;
> }
> }
> class Example {
> private Integer param;
> public Integer getParam() {
> return param;
> }
> public void setParam(Integer param) {
> this.param = param;
> }
> }
> interface Cracker<T extends Serializable>{
> T getParam();
> void setParam(T param);
> }
> class BrokenExample implements Cracker<Integer>{
> private Integer param;
> public Integer getParam() {
> return param;
> }
> public void setParam(Integer param) {
> this.param = param;
> }
> }
> *Expected result*
> example.param: 0
> brokenExample.param: 0
> *Actual result*
> example.param: 0
> brokenExample.param: null
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.