If care is not taken with the quoting of literals, the expression language (OGNL) will misinterpret a char as a String.
Wrong:
Why doesn't this work when myString is equal to A?
The solution is simple: flip the double and single quotes.
Right:
This works!
Another solution is to escape the double quotes in the String.
Also Right:
This works too!
來自官方的FAQ:
http://struts.apache.org/2.x/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html
posted on 2009-10-05 10:55
三刀流の逆風(fēng) 閱讀(784)
評(píng)論(1) 編輯 收藏 所屬分類:
Struts