Jump to content
Changes to the Jaspersoft community edition download ×

How to get images from web application contex


Recommended Posts

By: casey123 - casey123

How to get images from web application contex

2006-03-24 09:00

I have JasperReports running in a web application which uses Spring. If I put the jasper template files and images in the classpath (e.g com/report/admin/AdminReport.jrxml and com/report/admin/adminLogo.gif)and use getClass().getClassLoader.getResource(templateFileLocation) everything works fine.

 

But, there must eb a better solution where the images and the template files are located outside of the classpath and the application should be able to get to them.

 

For e.g.

 

webapp/

resources/

jasper/

AdminReport.jrxml

images/

reportLogo.gif

 

As i am using Spring I am trying to use Resource but am not able to get the file or the image. This is really baffling me. Seems to me that this should be straightforward and hence I must be missing something.

 

What is the general way of doing this in a web application context? Has anybody been able to get images from outside of the WEB-INF directory? Any help will be greatly appreciated.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...