Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Unable to Include Images in the HTML file

Thread view: 
007praveen@gmail.com - 02 Jan 2007 11:42 GMT
Hi All,
      Iam working on the OC4j standalone server,I am working on struts
technology,where in my jsp i have an Export button when I click that
the following code is executed.

else if (searchUsersBean.getOrgFormat().equals(HTML)) {
/*JasperCompileManager.compileReportToFile(ConfigManager.getJasperReportXML());*/
File reportFile = new File(ConfigManager.getJasperReport());
if (!reportFile.exists())
throw ExceptionUtil.getCSMSException(new Exception(), 9);
JasperReport jasperReport = (JasperReport) JRLoader
.loadObject(reportFile.getPath());
Map parameters = new HashMap();
parameters.put(REPORT_TITLE, USER_REPORT);
parameters.put(BASE_DIR, reportFile.getParentFile());
parameters.put(IMAGE_PATH, ConfigManager.getAcpLogo());
request.getSession().setAttribute(R_PARAMETER, parameters);
JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(
    userList);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
parameters, ds);
JRHtmlExporter exporter = new JRHtmlExporter();
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,
                    jasperPrint);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
PrintWriter out = response.getWriter();
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
exporter.exportReport();
}

The report is being executed but in the html file the images are not
properly included,Can any one help me out on this how to include the
images for an HTML format...

Thanks & Regards
Praveen Kumar.P
ck - 02 Jan 2007 12:25 GMT
> /*JasperCompileManager.compileReportToFile(ConfigManager.getJasperReportXML());*/
> File reportFile = new File(ConfigManager.getJasperReport());
[quoted text clipped - 18 lines]
> exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
> exporter.exportReport();

Seems that you are using JasperReports, what is IMAGE_PATH? If html is
getting generated and only images are not getting rendered see what is
there in the img tag <img src="somepathAndImageName"> Make sure that
you have set it within the web app folder and does not point to some
path outside your web application folder.

Cheers,
Ck
http://www.gfour.net
Lew - 02 Jan 2007 19:20 GMT
007praveen@gmail.com wrote:
>> /*JasperCompileManager.compileReportToFile(ConfigManager.getJasperReportXML());*/
>> File reportFile = new File(ConfigManager.getJasperReport());
[quoted text clipped - 18 lines]
>> exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
>> exporter.exportReport();

Just a hint: format and indent posted code for readability.

Best practice: enclose all if, while, and for blocks in braces, even for only
one line.

- Lew
meghnagrover@gmail.com - 27 Feb 2007 19:41 GMT
On Jan 2, 6:42 am, 007prav...@gmail.com wrote:
> Hi All,
>        Iam working on the OC4j standalone server,I am working on struts
[quoted text clipped - 32 lines]
> Thanks & Regards
> Praveen Kumar.P

Did you get the image problem working? I am getting a similar problem.
Any help would be appreciated.
Thanks,
meghna.
Sem - 27 Feb 2007 19:59 GMT
On Feb 27, 2:41 pm, meghnagro...@gmail.com wrote:
> On Jan 2, 6:42 am, 007prav...@gmail.com wrote:
>
[quoted text clipped - 41 lines]
>
> - Show quoted text -

Where did you insert the button image?
You have to call the image in the button where you declare.
And do not forget to put the path.

--sem


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.