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.   

    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    <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.aspx3.struts.xml    <struts>
        <package name="default" extends="tiles-default">
           <action name="go" class="com.action.MyAction">
               <!--result name="success">/next.jsp</result-->
               <result name="success" type="tiles">myapp.homepage</result>
           </action>
           </package>
    </struts>
    转自http://blog.csdn.net/haoxing272/archive/2007/07/22/1701741.aspx
      

  2.   

    直接访问/R/login.action正常否?
      

  3.   

    问题解决了
    直接访问login.action正常的问题的原因是 tiles把我的action当成文件处理了 所以访问不到把filter的顾虑范围加大之后就能对tiles里面的action进行过滤了!没在自己电脑上 没找到修改的代码回去之后补充啊 
      

  4.   

    终于搞定了:
    <filter-mapping>
      <filter-name>过滤器名称</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>INCLUDE</dispatcher>
     
    </filter-mapping>