struts2使用OGNL表达式访问方法与属性

	//访问静态变量
        PI:<s:property value="@java.lang.Math@PI"/>
	<br>
        //访问静态方法
         COS:<s:property value="@java.lang.Math@cos(1)"/>
        
        //访问对象方法
	<s:property value="setProperties('value')"/>
	
	<%
		String[] arg = new String[]{"aa","bb","cc","dd"};
		request.setAttribute("arg",arg);
	%>
	<br>
	arg.length:<s:property value="#attr.arg.length"/>
	<br>
	arg.[1]:<s:property value="#attr.arg[1]"/>


猜你喜欢

转载自blog.csdn.net/qq_36722039/article/details/79400655