您的位置:首页 > 运维架构 > Apache

org.apache.jasper.JasperException: /taglib/ifelse.jsp(17,2) According to TLD or attribute directive

2013-01-18 16:41 239 查看
在做课设的时候

用到<s:if test="$session.userName">

发现上边的异常

在网上找了找答案,发现下边的和我的错误时一样的,故拿来借鉴!

在运行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了

还有人说

struts2 _2.0.11 版本不支持 s 标签嵌套 EL

struts2_2.0.08 这个支持但是不支持集合封装pojo。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐