[ http://issues.apache.org/struts/browse/WW-1519?page=all ]

zhouyanming updated WW-1519:
----------------------------

    Description: 
public enum Status {
        INIT("init"), COMPLETED("completed");
        private String displayName;
        Status(String displayName){
                this.displayName=displayName;
        }
        public String getName(){
                return name();
        }
         public String getDisplayName(){
                return displayName;
        }
}

public class TestAction extends ActionSupport {
        private Status stauts = Status.COMPLETED;
        public List<Status> getStatusList() {
                return Arrays.asList(Status.values());
        }
        public String input() {
                return INPUT;
        }
}

<s:select label="%{getText('status')}" name="status" list="statusList" 
listKey="name" listValue="displayName" />

this tag doesn't bind value  'COMPLETED',the problem can resolved by modify the 
template file of select tag.
in file template/simple/select.ftl line 32 and line 53,change 
'parameters.nameValue'  to 'parameters.nameValue?if_exists?string',It works 
fine now,I think this problem also existed in webwork2



  was:
public enum Status {
        INIT("init"), COMPLETED("completed");
        private String displayName;
        Status(String displayName){
                this.displayName=displayName;
        }
        public String getName(){
                return name();
        }
         public String getDisplayName(){
                return displayName;
        }
}

public class TestAction extends ActionSupport {
        private Status stauts = Status.COMPLETED;
        public List<Status> getStatusList() {
                return Arrays.asList(Status.values());
        }
        public String input() {
                return INPUT;
        }
}

<s:select label="%{getText('status')}" name="status" list="statusList" 
listKey="name" listValue="displayName" />

this tag doesn't bind value  'COMPLETED',the problem can resolved by modify the 
template file of select tag.
in file template/simple/select.ftl line 32 and line 53,change 
'parameters.nameValue'  to 'parameters.nameValue.toString()',It works fine 
now,I think this problem also existed in webwork2




> 'select' tag cannot bind jdk5.0 enum type
> -----------------------------------------
>
>                 Key: WW-1519
>                 URL: http://issues.apache.org/struts/browse/WW-1519
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.1
>         Environment: null
>            Reporter: zhouyanming
>            Priority: Minor
>
> public enum Status {
>       INIT("init"), COMPLETED("completed");
>         private String displayName;
>         Status(String displayName){
>                 this.displayName=displayName;
>         }
>         public String getName(){
>                 return name();
>         }
>          public String getDisplayName(){
>                 return displayName;
>         }
> }
> public class TestAction extends ActionSupport {
>       private Status stauts = Status.COMPLETED;
>       public List<Status> getStatusList() {
>               return Arrays.asList(Status.values());
>       }
>       public String input() {
>               return INPUT;
>       }
> }
> <s:select label="%{getText('status')}" name="status" list="statusList" 
> listKey="name" listValue="displayName" />
> this tag doesn't bind value  'COMPLETED',the problem can resolved by modify 
> the template file of select tag.
> in file template/simple/select.ftl line 32 and line 53,change 
> 'parameters.nameValue'  to 'parameters.nameValue?if_exists?string',It works 
> fine now,I think this problem also existed in webwork2

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to