THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
In the example application's thankyou.jsp is this markup.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
<s:if test="personBean.over21"> <p>You are old enough to vote!</p> </s:if> <s:else> <p>You are NOT old enough to vote.</p> </s:else> |
...
The value of the test attribute must be an expression that evaluates to true or false, but doesn't need to be a method call that returns a boolean. For example this s:if tag that is in thankyou.jsp has a more complicated expression.
Code Block | ||||
---|---|---|---|---|
| ||||
<s:if test="personBean.carModels.length > 1"> <p>Car models </s:if> <s:else> <p>Car model </s:else> |
...
If the collection contains objects that have multiple fields, then you should use the value attribute of the s:property tag to determine what field to display. For example:
Code Block | |||||
---|---|---|---|---|---|
| |||||
<table style="margin-left:15px"> <s:iterator value="states" > <tr><td><s:property value="stateAbbr" /></td> <td><s:property value="stateName" /></tr> </s:iterator> </table> |
...