[搬家文]struts2/webwork的标签果然是没有最恶心只有更恶心
一直被struts2很没规律的标签搞得很头大,今天终于遇到迄今最恶心的一个问题了
有个if判断字符串是否相等的标签,一直没法正常工作,折腾半个下午...
终于网上某FAQ上找到答案
OGNL will interpret 'A' as a char type and not a string. Simple solution - flip the double and single quotes.
有个if判断字符串是否相等的标签,一直没法正常工作,折腾半个下午...
终于网上某FAQ上找到答案
Why won't the 'if' tag evaluate a one char string?
<ww:if test="#myObj.myString == 'A'">Why doesn't this work when myString is equal to A?</ww:if>
<ww:if test='#myObj.myString == "A"'>This works!</ww:if>
Alternatively, you can escape the double quotes in the String:
<ww:if test="#myObj.myString == \"A\"">This works!</ww:if>