使用spring-mvc框架时,jetty找不到spring.tld和spring-form.tld
只能把spring-mvc中的tld复制到WEB-INF中才能识别到tld
解决不用复制tld文件的方法如下:
配置Jetty-Context.xml
1 2 3 4 5 6 |
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Call name="setAttribute"> <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg> <Arg>.*/.*spring-webmvc-[^/]*\.jar$|.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg> </Call> </Configure> |
要读取其他jar包中的tld文件,也可以按正则配置到这里,即可读取,就不用再把tld解压出来后复制到WEB-INF中
相关maven配置
1 2 3 4 5 6 7 |
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <webDefaultXml>${project.basedir}/src/main/resources/jetty-web.xml</webDefaultXml> </configuration> </plugin> |
参考资料:
http://ju.outofmemory.cn/entry/241527
https://wiki.eclipse.org/Jetty/Howto/Configure_JSP
https://www.eclipse.org/jetty/documentation/9.2.7.v20150116/configuring-webapps.html