今天做项目遇到的问题,找了半天搞定了。
<s:iterator var="customer" value="custList">
<s:if test="${customer.custLevel==1}">vip 客户
</s:if>
</s:iterator>
这种写法在struts2.1.8中不支持el表达式,报一下异常:According to TLD or attribute directive in tag file, attribute test does not accept any expressions;;
然后改成
<s:iterator var="customer" value="custList">
<s:if test="%{#customer.custLevel==1}">vip 客户
</s:if>
</s:iterator>
这样就ok .. 如果判读的类型是字符串,要写成 " " ,不能用‘ ’ ;
这样写struts2 需要用到ongl...struts2默认ongl 是false;
在struts.xml 中添加此配置:
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
。。
问题解决了。。。