Jump to content
We've recently updated our Privacy Statement, available here ×

image not dispalying in html format in jasperreports


sabinash

Recommended Posts

 Hi All,

I am facing the problem to show the jasper report in html format from the last two weeks, its so much irritated, i tried everything to show the images in html format, still i could not get any solution,

actully what is heppening when i try to run the report in html format, the jasper report while creting the report it is internally creates a some images, like px, img_0_0_1 which are not available in our application's images folder, for that its showing no images icon in the htmal pages. when we try to open this px images in local drive nothing is there. But same thing is working fine in other format like PDF.

But after exporting to html format this report these imagrs are working fine but at the runtime the images are not working.

 

I am using struts2 for java application, i am calling jrxml file from the action classes,

For creating jrxml file i am using the ireport tool.

Can somebody help me how to get the proper iamges in the html format, its very urgent i stuck from last two weeks

 

Thanks in advance

Thanks And Regards

Abinash Sahu

 

 

Code:
my struts.xml<package name="default"        extends="struts-default,jasperreports-default">                                		<result-types>                    <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/>       </result-types><action name="getDateWiseReport" class="com.realsoftinc.demoreport.action.ReportOneAction" method="reportone">			<result name="success" type="jasper">				<param name="location">                    jasper/report3.jasper                </param>                <param name="dataSource">jasperList</param>              	<param name="format">HTML</param>                			</result>				</action>My action classs: @SuppressWarnings("unchecked")	public String reportone()	 {		 			  JasperReport jasperReport;  			  JasperPrint  jasperPrint;  			  JasperDesign jasperdesign; 			  			  FileReadWriteOperation frwo = null;			  try{				  frwo = new FileReadWriteOperation();				  jasperList=frwo.showReportOne();				  String reportSource;				  String sourceFile;		          reportSource = ServletActionContext.getServletContext()   		                    .getRealPath("/jasper/report3.jrxml"); 		          		          HashMap map = new HashMap();		          /*String jasperPath= new String(ServletActionContext.getServletContext().getRealPath("/jasper/"));		      	String imagePath = new String(ServletActionContext.getServletContext().getRealPath("/images/"));		      	String jspPath = new String(ServletActionContext.getServletContext().getRealPath("/jsp/"));		          		          map.put("imagePath",imagePath);		          map.put("jspPath", jspPath);*/		          /*sourceFile = ServletActionContext.getServletContext()                     .getRealPath("/jasper/report3.jasper"); */		         JRBeanCollectionDataSource datasource = new JRBeanCollectionDataSource(jasperList);		         jasperReport = JasperCompileManager.compileReport(reportSource);		         jasperPrint = JasperFillManager.fillReport(jasperReport, map, datasource);		         //JasperRunManager.runReportToHtmlFile(sourceFile, new HashMap(), datasource);		         //JasperViewer.viewReport(jasperPrint, false);		        		       		         			  }catch (Exception e) {				// TODO: handle exception				  e.printStackTrace();			}		 return SUCCESS;	 }
Link to comment
Share on other sites

  • 10 months later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

hi

i have the same problem, the pixel images problem waas solved using this parameter

JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, false in the JRHtmlExporter.

but i still have a prolem, images are not showed, i use a url element to insert images, and jasper reports, in the img tag, inserts me an invalid local path, instead of my url.

nullimg_0_0_0_2

instead of

http://mysite/image.png

 

any ideas?

thanks

Link to comment
Share on other sites

  • 1 year later...

You can easily show image in PDF format, right? Does above suggestion solve your image displaying problem? If not, please check whether following posts can help you or  not. Please mark it if it helps.http://community.jaspersoft.com/sites/all/libraries/ckeditor/plugins/smiley/images/sad_smile.gif

http://stackoverflow.com/questions/6828012/images-is-not-displaying-in-ireport-html-format

http://community.jaspersoft.com/questions/531045/image-not-displayed-html-view

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...