org.apache.tiles.definition.NoSuchDefinitionException:找不到名为“addCustomer.tiles"的定义 [英] org.apache.tiles.definition.NoSuchDefinitionException: Cannot find definition named 'addCustomer.tiles'
本文介绍了org.apache.tiles.definition.NoSuchDefinitionException:找不到名为“addCustomer.tiles"的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是tiles的新手.我已经按照以下方式配置了我的tiles.xml:
I am new to tiles.I have configured my tiles.xml in following way:
<tiles-definitions>
<definition name="baseLayout" template="/template/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/template/Header.jsp" />
<put-attribute name="menu" value="/template/Menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/template/Footer.jsp" />
</definition>
<definition name="/addCustomer.tiles" extends="baseLayout">
<put-attribute name="title" value="Customer Form" />
<put-attribute name="body" value="/addCustomer.jsp" />
</definition>
</tiles-definitions>
我的struts.xml如下:
My struts.xml is as follows:
<struts>
<constant name="struts.convention.action.includeJars" value=".*?\.jar(!/|/)?" />
<constant name="struts.convention.action.fileProtocols" value="jar,zip" />
<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="addCustomer" class="com.adv.web.action.CustomerAction" method="addCustomer">
<result name="addCustomer" type="tiles">/addCustomer.tiles</result>
</action>
</package>
</struts>
我已将 web.xml 配置如下:
I have configured web.xml as follows:
<context-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>
/WEB-INF/tiles/tiles.xml
</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.adv.web.action</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
我在 pom.xml
文件中添加了 struts2-tiles-plugin
.
I have added struts2-tiles-plugin
in pom.xml
file.
当我点击以下网址时:localhost:7001/AddStrutsViewer-1.0/addCustomer我收到以下异常
when I am hittng following url: localhost:7001/AddStrutsViewer-1.0/addCustomer I am getting following exception
INFO: Publishing TilesContext for context:
org.apache.struts2.tiles.StrutsWildcardServletApplicationContext
org.apache.tiles.definition.NoSuchDefinitionException: Cannot find definition named 'addCustomer.tiles'
谁能找出问题所在?
推荐答案
/addCustomer.tiles
/addCustomer.tiles
应该是
addCustomer.tiles
addCustomer.tiles
代替
这篇关于org.apache.tiles.definition.NoSuchDefinitionException:找不到名为“addCustomer.tiles"的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文