最近开发中发现用displayTag装页面时,如果统计的列表过宽,你如果一个月的31天数据的统计,左边的struts-menu菜单就不见了,没得法,不得不要修改siteMesh的装饰器模板,增加一个打印的decorator的文件,为了测试,先在decorator增加一个print打印模板的JSP文件,取名为printable.jsp,然后随便写如下内容到文件中
[code]<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<html>
<head>
<title><decorator:title default="Welcome!" /></title>
<decorator:head />
</head>
<body onload="window.print();">
Printed on <%=new java.util.Date()%>.<br/>
<hr noshade="noshade" size="1"/>
<br/>
<decorator:body />
</body>
</html>[/code]
再配置decorators.xml的装饰规则<decorator name="printable" page="printable.jsp">
[code]<pattern>*/print/*</pattern>
</decorator>[/code]
同时把主装饰中[code]<decorators defaultdir="/decorators">
<excludes>
<pattern>/demos/*</pattern>
<pattern>/resources/*</pattern>
<pattern>*/map/*</pattern>
<pattern>/print/*</pattern>
</excludes>[/code]加上/print/*的例外配置,表示/print/*的目录下请求都不使用主装饰器处理,呵
然后我把web/page/print/目录下,建一个所需的printList.jsp文件,让它应用print.jsp的装饰器,以为大功告成了,提交请求,结果还是应用了主装饰器,百般思绪,弄了一上午,不行,出去洗洗回来,查看一下源码,才发现sitemesh的装饰方式在通过在web.xml文件中配过滤器实现的,意味着,目录的请求都是表示http://www.pben.cn/print/类似的方式工作的,如果要应用print目录的规则就得改一下你的form action的链接前面加上/print/路径才行,[u][size=18][color=red][b]关键点:[/b][/color][/size]更改form action=/print/printActionController[/u],再改一下actionservlet.xml的配置把原来指定为”/printActionController"的映射处理更改为“/print/printActionController",重启tomcat,成了,幸福中,希望有弄appfuse方面的朋友,能从我的文章及错误中吸取取经验,呵^_^
[code]<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<html>
<head>
<title><decorator:title default="Welcome!" /></title>
<decorator:head />
</head>
<body onload="window.print();">
Printed on <%=new java.util.Date()%>.<br/>
<hr noshade="noshade" size="1"/>
<br/>
<decorator:body />
</body>
</html>[/code]
再配置decorators.xml的装饰规则<decorator name="printable" page="printable.jsp">
[code]<pattern>*/print/*</pattern>
</decorator>[/code]
同时把主装饰中[code]<decorators defaultdir="/decorators">
<excludes>
<pattern>/demos/*</pattern>
<pattern>/resources/*</pattern>
<pattern>*/map/*</pattern>
<pattern>/print/*</pattern>
</excludes>[/code]加上/print/*的例外配置,表示/print/*的目录下请求都不使用主装饰器处理,呵
然后我把web/page/print/目录下,建一个所需的printList.jsp文件,让它应用print.jsp的装饰器,以为大功告成了,提交请求,结果还是应用了主装饰器,百般思绪,弄了一上午,不行,出去洗洗回来,查看一下源码,才发现sitemesh的装饰方式在通过在web.xml文件中配过滤器实现的,意味着,目录的请求都是表示http://www.pben.cn/print/类似的方式工作的,如果要应用print目录的规则就得改一下你的form action的链接前面加上/print/路径才行,[u][size=18][color=red][b]关键点:[/b][/color][/size]更改form action=/print/printActionController[/u],再改一下actionservlet.xml的配置把原来指定为”/printActionController"的映射处理更改为“/print/printActionController",重启tomcat,成了,幸福中,希望有弄appfuse方面的朋友,能从我的文章及错误中吸取取经验,呵^_^