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 http://www.springframework.org/tags/form

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:


http://www.springframework.org/tags/form
spring-form.tld



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文件中添加标签我试过了好像不行,但是也没深究,只要上面能解决问题就行了。。。

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


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

你可能感兴趣的:(Can not find the tag library descriptor for "http://www.springframework.org/tags/form" 解决方法)