日期:2014-05-17  浏览次数:20885 次

sitemesh中 <page:applyDecorator/>访问不了struts2中的action?
大家好,我在struts2中使用sitemesh,在母版页中我想使用<page:applyDecorator page="cruduser.action" name="panel"/>标签加入另外的一个母版页。但是提示“cruduser.action did not create a valid page to decorate”。代码如下:
HTML code
<body>
  <div>母版页的标题</div>
  <page:applyDecorator page="cruduser.action" name="panel"></page:applyDecorator>
   <table>
        <tr>
           <td><decorator:title/></td>
        </tr>
      <tr>
         
         <td><decorator:body/></td>
      </tr>
   </table>
   <div>母版页的footer</div>
  </body>
望求教

------解决方案--------------------
可以查一下cruduser.action生成的结果页面(或片段)是否是XML平衡的(即起标尾标配)。
另,sitemesh的毛病就是性能问题。Tiles就好一些。
------解决方案--------------------
兄弟,回答的有点晚..我也遇到了跟你差不多的问题,不过不确定是不是完全一样,可以这么解决:

HTML code

<page:applyDecorator name="common">
    <s:action name="naviBar" namespace="/" executeResult="true" />
</page:applyDecorator>