You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "lwen.ma (JIRA)" <ji...@apache.org> on 2012/11/01 08:03:11 UTC

[jira] [Commented] (WW-3909) Not set parameter value to Action correctlly

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

lwen.ma commented on WW-3909:
-----------------------------

This is bug of OGNL, the follow code can reproduce the case:

import ognl.Ognl;
import ognl.OgnlException;

public class OgnlTest {

    public static void main(String[] args) {
        HelloAction action = new HelloAction();
        action.setpName("pName.Foo");

        try {
            Object pName = Ognl.getValue("pName", action);
            System.out.println(pName);
        } catch (OgnlException e) {
            e.printStackTrace();
        }
    }
}
                
> Not set parameter value to Action correctlly 
> ---------------------------------------------
>
>                 Key: WW-3909
>                 URL: https://issues.apache.org/jira/browse/WW-3909
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.3.4.1, 2.3.6
>         Environment: JDK: 1.6.0_37
> AS: Tomcat 7.0.22
>            Reporter: lwen.ma
>            Priority: Critical
>             Fix For: 2.3.7
>
>
> Sample code:
> -------------------------------------------------
> import com.opensymphony.xwork2.ActionSupport;
> public class HelloAction extends ActionSupport {
>     private String pName;
>     public String execute() {
>         return SUCCESS;
>     }
>     public String getpName() {
>         return pName;
>     }
>     public void setpName(String pName) {
>         this.pName = pName;
>     }
> }
> -------------------------------------------------
> I can't set param's value use url '{contextPath}/hello.action?pName=111'.
> According to JavaBeans Spec sec 8.8 "Capitalization of inferred names":
> Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. So for example,
> “FooBah” becomes “fooBah”
> “Z” becomes “z”
> “URL” becomes “URL”
> We provide a method Introspector.decapitalize which implements this conversion rule.
> String java.beans.Introspector.decapitalize(String name)
> Utility method to take a string and convert it to normal Java variable name capitalization. This normally means converting the first character from upper case to lower case, but in the (unusual) special case when there is more than one character and both the first and second characters are upper case, we leave it alone. 
> Thus "FooBah" becomes "fooBah" and "X" becomes "x", but "URL" stays as "URL".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira