Spring jPetStore err:org.apache.jasper.JasperException: /WEB-INF/jsp/struts/IncludeTop.jsp(23,0) According to TLD or attribute d

Sping Demo JpetStore 当web.xml配置和struts整合时,运行jsp页面会出现如下错误:

org.apache.jasper.JasperException: /WEB-INF/jsp/struts/IncludeTop.jsp(23,0) According to TLD or attribute directive in tag file, attribute test does not accept any expressions.

原因是jstl 的包tld文建已经打好到standard包中,这个standard.jar是1.0版本的核心库tld描述,而jsp页面使用的都是jstl1.1的语法,所以必须把1.1的tld拷贝到WEB-INF/下,并在web.xmll中重新定义taglib,为了尽量不修改jsp文件对jstl的引用,按照jsp引用taglib的uri来修改web.xml中jstl的taglib的uri。如下:

<jsp-config>
  <taglib>
      <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
    </taglib>
     <taglib>
  <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
  <taglib-location>/WEB-INF/fmt.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
  <taglib-location>/WEB-INF/sql.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
  <taglib-location>/WEB-INF/x.tld</taglib-location>
 </taglib>
    </jsp-config>

jsp页面使用

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

这样就不报错了。

这样就不报错了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值