Checking request parameter value in Struts2 tag

后端 未结 2 786
温柔的废话
温柔的废话 2021-01-14 17:42

I have the following code in my jsp:



2条回答
  •  一向
    一向 (楼主)
    2021-01-14 18:22

    Edit: There is a difference between "" (double quotes) and '' (single quotes) in OGNL.

    Double quotes evaluate single characters to strings while single quotes evaluate single characters to Character types. You may put multiple characters in single quotes and it will be evaluated as a string.

    Further request scope is not

    Map 
    

    but

    Map 
    

    as can be seen below in last 5 lines of the jsp.

    JSP

    <%@taglib prefix="s" uri="/struts-tags"%>
    
    




















    1:
    2:
    3:


    Test.jsp (Action)

    package struts2; import com.opensymphony.xwork2.ActionSupport;

    public class test extends ActionSupport{
        public String letters = "abcd";
        public int number = 1;
    }
    

提交回复
热议问题