posts - 55,comments - 89,trackbacks - 0

执行某jsp页面时,弹出如标题所示异常,jsp代码如下:

<%@ page language="java" contentType="text/html;charset=gbk" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  </head>
 
  <body>
    This is the result:
    <c:out value="${userInfo}" default="没有结果"/>
  </body>
</html>


异常的原因是不能识别“${userInfo}”,解决办法有两种:
一、在page指令里,加入isELIgnored="true"属性,即
<%@ page language="java" contentType="text/html;charset=gbk"  isELIgnored="true" %>
二、把<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>变为:
<%@ taglib prefix="c" uri=http://java.sun.com/jstl/core_rt  %>
经过改动之后,jsp页面能正常执行了。
posted on 2008-11-07 16:48 jiafang83 阅读(27825) 评论(7)  编辑  收藏

FeedBack:
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2008-11-18 18:37 | eyejava
如果页面不能识别EL表达式,页页上会直接原样输出你写的EL表达式,这时使用方法1即可,第二种情况就跟tld有关了,必须与你的jstl.jar包定义的tld相一致,这时如果遇到“According to TLD or attribute directive in tag file, attribute value does not accept any expressions”这种异常,你可以打开自己的jstl.jar看一下它的meta-inf下相关的tld文件是如何定义相关标签的,一般都是引用prefix时出错,版本原因。  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2012-01-04 16:13 | 熊哲
非常感谢,我类似的问题已经解决了  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2012-01-04 16:14 | 熊哲
非常感谢,我类似的的问题已经解决了!  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2012-10-17 22:42 | 月亮之城

谢谢你,解决了困扰我很长时间的问题。  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2013-05-26 00:18 | wwwzhw2012
非常感谢,方法一解决问题  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2014-03-13 16:56 | ??
太有用了,六年前你就知道了,现在我才遇到  回复  更多评论
  
# re: According to TLD or attribute directive in tag file, attribute value does not accept any expressions
2014-11-05 20:19 | 的撒
终极解决www.cnblogs.com/sweetculiji/p/4077253.html  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: