Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I escape values in SpEL?

I am writing some SpEL statements in XML, and I can't get the parser to determine when I need to escape a character.

I've attempted the following:

<... property="someProperty" value="#{ someBean.aMethodOnTheBean('st\'ring') }" />

However adding in the \' does not seem to escape that single quote and I keep receiving a parser exception.

Is there any way to escape these values?

like image 578
Scott Avatar asked Nov 29 '10 21:11

Scott


1 Answers

From the documentation:

"To put a single quote itself in a string use two single quote characters."

expression = 'something = ''' + someMethod.getValue + ''''

like image 108
Damon Avatar answered Sep 28 '22 04:09

Damon