Jump to content

Excepion while compilation


sebastianr

Recommended Posts

Hi,

 

I have the below snippet in my report xml.

 

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false">

 

<reportElement x="870"

 

y="67"

 

width="189"

 

height="20"

 

forecolor="#00AAAA"

 

key="textField" />

 

<textElement textAlignment="Right" />

 

<textFieldExpression class="java.lang.String">

 

<![CDATA["Page " + String.valueOf($V{PAGE_NUMBER})]]>

 

</textFieldExpression>

 

</textField>

 

 

I am getting this exception.

 

1. Syntax error on token "{", delete this token

 

value = (java.lang.String)("Page " + String.valueOf($V{));//$JR_EXPR_ID=21$

 

^

 

 

since i am using velocity, i modified the above snippet like below then it is working fine.

 

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false">

 

<reportElement x="870"

 

y="67"

 

width="189"

 

height="20"

 

forecolor="#00AAAA"

 

key="textField" />

 

<textElement textAlignment="Right" />

 

#set( $pageno = '$V{PAGE_NUMBER}' )

 

<textFieldExpression class="java.lang.String">

 

<![CDATA["Page " + String.valueOf($pageno)]]>

 

</textFieldExpression>

 

</textField>

 

 

is this anything related jasper or velocity that i am using?

 

What i have done is, i have prepared a .jrxml and i renamed it as .vm for velocity use. is this causing problem?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month later...

Hello Lucianc,

Can you tell me how to escape '$' characters to get proper .jrxml output from the velocity?

Actually i don't understand how to preserved '$' character in .jrxml file.so can you give some more information related to it

 

Thank you,

thevoice.

Link to comment
Share on other sites

thevoice wrote:

Can you tell me how to escape '$' characters to get proper .jrxml output from the velocity?

 

This is exactly what I've explained in the previous post. To escape $ characters in velocity templates, you need to prefix them with a backslash. My example again:

Code:
"Page " + String.valueOf($V{PAGE_NUMBER})

 

Regards,

Lucian

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