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

How to set Relative Path for an Image with Ireport


6sic6

Recommended Posts

I don't find the way to set a relative path for an image that I've put in my report

my image stay on my WEBAPP-root/img/myimage.gif

ho can I define this in Ireport?

can you help me in a simple step-by-step

thx a lot guys

martina

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I know how to do it with JSF...

 

I put a method in the JSF managed bean named getBaseDir(). It looks like this:

 

public String getBaseDir()

{

String baseDir = "/WEB-INF/reports";

try

{

return FacesContext.getCurrentInstance()

.getExternalContext()

.getResource(baseDir)

.getPath();

}

catch (MalformedURLException mue)

{

log.error(mue, mue);

return null;

}

}

 

Then, add a parameter to the parameter map:

 

map.put("base_dir", getBaseDir());

 

Finally, in the report itself, the graphics element "image expression" is:

 

new File($P{base_dir},"images/logo.gif")

Link to comment
Share on other sites

  • 10 years later...

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