Jump to content
Changes to the Jaspersoft community edition download ×

images in Struts


Recommended Posts

hi, i have a problem with my images.


Situation: my reports are in a quite large webapplication and the .jasper-files are in the folder resources/reports/. The image i need is in another folder, resources/_images/. This has to be like this because of the guidelines, we have to use.


Problem: the reports does not find my images with relative paths, but i am not allowed to use absolute paths in this surrounding.


What can i do? any ideas? the classpath of the application should not be changed.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic



You could prefix the image locations with a parameter.

Let's call this parameter BASE_FOLDER.

You could detect the absolute location of this BASE_FOLDER by interrogating the context of the web application.


Check our /demo/samples/webapp sample for more details on this.


I hope this helps.


Link to comment
Share on other sites

that was also an idea, but i first wanted to know, if there are other solutions. i will try it with the parameter.


hm, I checked that sample webapps, and it is similar to my projects. I also tried it with the context.getRealPath() method, but the returned path is not the path of the webapplication in the server (tomcat). So, when i give that path as parameter, that way also does not work.


for your understanding: the build of the project copies the war-file to the webapps-folder of the tomcat and the context.getRealPath() method gives me the path of the original file in my project-workspace.


any hints for me?

Post edited by: wegnerk, at: 2006/09/21 11:27

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