Can not find the tag library descriptor for "http://www.springframework.org/tags/form" 解决方法

1. 今天在写东西的时候突然遇到这个问题:

For Spring 3 the tag library specified in the tag library directive (http://www.springframework.org/tags/form) is in the org.springframework.web.servlet-3.x.x.jar file. The URI in the directive must match the URI in the META-INF/spring-form/tld file in this jar file which is <uri>http://www.springframework.org/tags/form</uri>

The container (at least Tomcat 7.0 does) will match the URI in the taglib directive of the jsp file, with the URI in the spring-form.tld file provided org.springframework.web.servlet jar-3.xx.jar is in the WEB-INF/lib directory.

If you also add an entry to web.xml for the same tag library like:
<jsp-config>
<taglib>
<taglib-uri>http://www.springframework.org/tags/form</taglib-uri>
<taglib-location>spring-form.tld</taglib-location>
</taglib>
</jsp-config>

then the container will only look for WEB-INF/spring-form.tld and will not find the tld in the jar file. To make this work you need to manually extract the spring-form.tld from the jar file and add it to the WEB-INF directory. I don't know of any good reason to do this and suspect that having an entry in web.xml is historic and now only causes confusion.

1.  大意是说:http://www.springframework.org/tags/form这个标签库是由org.springframework.web.servlet-3.x.x管理的。对于jsp引擎去解析这个标签库的时候,他是在org.springframework.web.servlet-3.x.x / META-INF/spring-form.tld这个tld文件中查找的。因此只需要在spring-web中有这个tld文件就行了!但是为什么我的这个标签就是无法解析呢???

我此时用的是spring-web.3.2.4.RELEASE版本,我在org.springframework.web.servlet-3.2.4中居然没有找到/META-INF/spring-form.tld文件!!!这难道是版本不兼容的问题,于是我重新换了spring-web.3.2.2.RELEASE版本,这个问题就解决了。。。   


2.  用web.xml文件中添加<jsp-config>标签我试过了好像不行,但是也没深究,只要上面能解决问题就行了。。。

我猜测应该是新版本的问题吧。。。


参考:http://forum.spring.io/forum/spring-projects/web/74017-the-absolute-uri-http-www-springframework-org-tags-form-cannot-be-resolved

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值