OGNL Syntax Issue

前端 未结 2 1320
走了就别回头了
走了就别回头了 2021-01-15 08:42

I have a Struts 2 JSP page with the following snippet:


which correctly prints out the value of

2条回答
  •  粉色の甜心
    2021-01-15 08:58

    
    

    is a correct syntax, but to get the value of the method that have a signature

    public String myMethod(String value){
      return value;
    }
    

    required the getter for myVariable

    public String getMyVariable() {
      return myVariable;
    }
    

    if you set the value to myVariable like

    private String myVariable = "myValue";
    

    then it should be printed in JSP. If the argument is other type it will be converted to String and the method will call.

提交回复
热议问题