iReport4.5.1、Struts2.2.3生成Html文档时页面红叉叉的解决办法。
这些个小红叉叉甚的恼人!
解决方法如下:
而且后台报错:
提示找不到名字为px的action
- 警告: Could not find action or result
- There is no Action mapped for namespace /images and action name px. - [unknown location]
- at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
- at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
- at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
- at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
- at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
- at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
- at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
- at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
- at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
- at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
- at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
- at java.lang.Thread.run(Thread.java:619)
具体的请查看源码:
struts2-jasperreports-plugin-2.2.3.jar
下面 JasperReportsResult.class文件
①提取px.gif图片
在jasperreports-4.5.1.jar中查找
具体路径如下:
jasperreports-4.5.1\net\sf\jasperreports\engine\images\pixel.GIF
重命名为px.gif放在项目的images文件夹下面。
②修改Struts2配置文件:
- <package name="px" namespace="/images" extends="struts-default">
- <action name="px">
- <result>/images/px.gif</result>
- </action>
- </package>
本文转自 w156445045 51CTO博客,原文链接:http://blog.51cto.com/enetq/855982,如需转载请自行联系原作者