当前位置: 代码迷 >> Java Web开发 >> 求救 struts2跟tiles的有关问题
  详细解决方案

求救 struts2跟tiles的有关问题

热度:542   发布时间:2016-04-17 00:07:24.0
求救 struts2跟tiles的问题
index.jsp页面有如下代码:

<tiles:insertTemplate template="/layout/basiclayout.jsp" flush="true"> 
<tiles:putAttribute name="header" value="/public/index_header.jsp"/> 
<tiles:putAttribute name="left" value="/public/login_left.jsp"/> 
<tiles:putAttribute name="body" value="/login.action"/>
<tiles:putAttribute name="footer" value="/public/index_footer.jsp"/> 
</tiles:insertTemplate> 

我想在定义的tiles里面的value属性上赋action的值 

就是这个put-attribute上的部分显示的是action之后的结果 

但是每次显示的结果都是有错误的 其他的部分正常 只有action的地方显示 
  The requested resource (/R/login.action) is not available 
我的项目名称为为R 

但是我要是直接访问login.action就正常 
不知道为什么 求解!! 万分感谢

------解决方案--------------------
1.首先要导入以下包
tiles-core-2.0-20070207.130156-4.jar,
tiles-api-2.0-20070207.130156-4.jar,
struts2-tiles-plugin-2.0.6.jar,
2.以下内容添加到web.xml 
XML code
   <context-param>       <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>       <param-value>           org.apache.struts2.tiles.StrutsTilesContainerFactory       </param-value>    </context-param>        <context-param>       <param-name>   org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG       </param-name>       <param-value>/WEB-INF/tiles.xml</param-value>    </context-param>     <listener>       <listener-class>           org.apache.struts2.tiles.StrutsTilesListener       </listener-class>    </listener>http://blog.csdn.net/haoxing272/archive/2007/07/22/1701741.aspx
------解决方案--------------------
直接访问/R/login.action正常否?
------解决方案--------------------
帮顶
  相关解决方案