struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Brown (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (WW-2218) Parameters binding mismatch
Date Fri, 02 May 2008 01:17:06 GMT

     [ https://issues.apache.org/struts/browse/WW-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Don Brown resolved WW-2218.
---------------------------

       Resolution: Incomplete
    Fix Version/s:     (was: 2.1.2)
         Assignee: Don Brown

It seems this is an OGNL bug and not specific to Struts.  If there is something Struts can
do to resolve it outside OGNL, please reopen.

> 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
>            Assignee: Don Brown
>
> 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.


Mime
View raw message