EL表达式中的字符比较 [英] char comparison in EL expression
本文介绍了EL表达式中的字符比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做这样的事情:
< c:if test =$ {somestring.charAt )=='1'}>
tadaaaam
< / c:if>当系统为11011但不工作时,
我可以用
打印 $ {somestring.charAt(0)}
,它是'1',但上面的比较失败。以下比较:
if(somestring.charAt(0)=='1')
worx(条件为true)在纯Java中。
/ p>
解决方案EL似乎对char有麻烦。这是我能使它工作的唯一方法。
< c:if test =$ {somestring.charAt(0)=='1'.charAt(0) }>
tadaaaam
< / c:if>
I want to do something like this:
<c:if test="${somestring.charAt(0)=='1'}"> tadaaaam </c:if>
when somestring is "11011" but it doesn't work. I can print it with
${somestring.charAt(0)}
and it is '1' but comparison above fails. The following comparison:
if(somestring.charAt(0)=='1')
worx (condition is true) in pure Java.
Any ideas?
解决方案EL seems to have trouble with char. Here is the only way I could make it work.
<c:if test="${somestring.charAt(0) == '1'.charAt(0)}" > tadaaaam </c:if>
这篇关于EL表达式中的字符比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文