使用 Maven 时找不到图块的标签库描述符
这是我在 web.xml
文件中的配置
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这是 pom.xml
中的配置
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
它一直说: 找不到“http: 的标签库描述符” //struts.apache.org/tags-tiles"
当我将 taglib 添加到布局中时:
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%>
当我在服务器上运行时:
SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener
我在这里错过了什么吗?
Here is my config in web.xml
file
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Here is the config in pom.xml
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.2.2</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
It keeps saying this: Can not find the tag library descriptor for "http://struts.apache.org/tags-tiles"
when I add taglib into layout:
<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%>
And when I run on server:
SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener
Did I miss something here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢 Kenny Lee 几周后我找到了这个问题的解决方案:((
您需要通过以下方式配置 Eclipse 项目设置:
对于 Eclipse 3.6 单击此处了解更多信息
有时,配置后您必须刷新项目或使用
mvn clean
和mvn install
,它就会起作用Thanks to Kenny Lee I found out the solution for this one after weeks :((
You’ll need to configure your eclipse project settings by:
For Eclipse 3.6 Click Here for more information
Sometimes after configuration you have to refresh the project or use
mvn clean
andmvn install
and it will do the tricks您的 web.xml 缺少 taglib 声明:
your web.xml is missing the taglib declaration:
如何使用 这个例子来看看它是否有效?
正如您的 相关问题,它看起来像
struts2-tiles
依赖项是必需的,也许您不需要struts2-spring-plugin
。How about using the dependency versions as specified in this example to see if it works?
As answered in your related question, it looks like
struts2-tiles
dependency is required and maybe you do not needstruts2-spring-plugin
.