Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL Comparison Syntax  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1775
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following JSTL line of code causes error:

An exception occured trying to convert String "dm_job_order Like " to type "java.lang.Double"

How can this code be fixed so it reads the '%' with the rest of the string?
Note: The % is a db2 database wildcard symbol.


 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, after picking myself up off the floor to see SQL syntax used in a JSP...

You are using a quote character within a string delimited by quote characters. How would you handle this if it were Java?
 
Steve Dyke
Ranch Hand
Posts: 1775
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:OK, after picking myself up off the floor to see SQL syntax used in a JSP...

You are using a quote character within a string delimited by quote characters. How would you handle this if it were Java?


I tried Escape characters but that did not work:

[code]

<c:when test="${qfJobNumberString == 'dm_job_order Like \'%\''}">

[code]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, I know that you know this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting case you've got here. If the EL expression is outside the attribute value of the tag, the normal back-slash quoting works fine.

Apparently the triple-level of dual-purpose quoting when it's embedded inside a quoted attribute value adds a level of complexity to the parsing issue.

Rather than dither around trying to find the right combination of bizarre escaping that'd make this pass the parser, (at least for the moment) I'd set the string literal into a variable using <c:set>, and then use the variable in the expression.
 
Steve Dyke
Ranch Hand
Posts: 1775
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Interesting case you've got here. If the EL expression is outside the attribute value of the tag, the normal back-slash quoting works fine.

Apparently the triple-level of dual-purpose quoting when it's embedded inside a quoted attribute value adds a level of complexity to the parsing issue.

Rather than dither around trying to find the right combination of bizarre escaping that'd make this pass the parser, (at least for the moment) I'd set the string literal into a variable using <c:set>, and then use the variable in the expression.


Thanks, You are a Genius.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!