Performance - template compiling and image

0

Hello, 

I have a question. I am a beginner in jasper and I have to know if is difference in performance between defining an image in a template static or dynamicaly via parameter.

For example I can define the image in template like this:

1) setting parameter

URL url = this.getClass().getClassLoader().getResource("pdf/my_image.tif");
parameters.put("logo", url);

declaration in a template

<parameter name="logo" class="java.net.URL">
    <defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>


usage in a report/template

<image>
   <reportElement x="100" y="30" width="135" height="30"/>
   <imageExpression><![CDATA[$P{logo}]]></imageExpression>
</image>


2) defines the path in the template

<imageExpression class="java.lang.String">
      <![CDATA[$P{REPORTS_DIR} + "/images/logo.jpg"]]>
</imageExpression>

Is needed compiling the template repeatedly (see 1)? Is difference between 1 and 2 in performance?

Thank you in advance

Pavel Slavicek

slavicekpavel's picture
Joined: Aug 1 2016 - 3:06am
Last seen: 4 years 2 months ago

0 Answers:

No answers yet
Feedback
randomness