SSH项目中使用struts-tags报错According to TLD or attribute directive in tag file, attribute test does not accept any expressions

在运行struts2标签页面时报错,代码如下:
<%@ page language="java" pageEncoding="gbk"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>index</title>
</head>
<body>
  <s:set name="age" value="29" />
  <s:if test="${age > 60}">
      老年人
  </s:if>
  <s:elseif test="${age > 35}">
      中年人
  </s:elseif>
  <s:elseif test="${age > 15}" id="wawa">
   青年人
  </s:elseif>
  <s:else>
      少年
  </s:else>
</body>
</html>

错误提示如下:
2008-3-12 10:53:13 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /taglib/ifelse.jsp(17,2)According to TLD or attribute directive in tag file, attribute test does not accept any expressions


经查找发现解决办法如下
错误提示是,该标签不能接受el表达式
struts2.0标签主要支持的是ognl表达式
所以把<s:elseif test="${age > 35}">
改为<s:elseif test="#age>35">
就ok了

改成下面:

猜你喜欢

转载自www.cnblogs.com/qianzf/p/11118692.html