Forums Register Login

JSTL Comparison Syntax

+Pie Number of slices to send: Send
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.


+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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]
+Pie Number of slices to send: Send
Now, I know that you know this.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
I just had the craziest dream. This tiny ad was in it.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2633 times.
Similar Threads
passing object from JSTL into applet
Mixing JSTL and JSP?
How to create Session
model.addAttribute value won't display using JSTL in my jsp file
JSTL and c:set
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:02:01.