Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.
Description
Perform basic condition flow. 'If' tag could be used by itself or can be followed by zero or more 'Else if' Tags followed by zero or one 'Else' Tag.
2 Comments
neo wang
when you test a string which has only one char (or more, I haven't tested), you should use double quotes instead of single quote, because it will cause error:
Caught an exception while evaluating expression 'wed == 'Y'' against value stack
java.lang.NumberFormatException: For input string: "N"
Solution: change single quote to double quotes
Before:
<s:iterator value="meetings">
<s:if test="%
">XXXWeeeednesday</s:if>bbb<br>
</s:iterator>
After:
<s:iterator value="meetings">
<s:if test='%
'>XXXWeeeednesday</s:if>bbb<br>
</s:iterator>
Reference: http://openfre.spaces.live.com/blog/cns!577CB612A686934B!355.entry
http://mail-archives.apache.org/mod_mbox/struts-user/200802.mbox/%3C15722468.post@talk.nabble.com%3E
Root cause:
Quote:
newton.dave wrote:
>
> IIRC a single-character in single quotes will evaluate to a character, not
> a
> string. Not entirely sure I get the exception without looking at the
> source.
Dave Newton
This is in the FAQ and other places in the documentation.
Multiple characters can be placed in single-quotes; it's only when it's a single character in single quotes.