...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<s:textfield key="state.label" name="state" value="CAca"/> |
If a textfield
is passed the value attribute "CAca"
, the framework will look for a property named getCa
. Generally, this is not what we mean. What we mean to do is pass a literal String. In the expression language, literals are placed within quotes
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<s:textfield key="state.label" name="state" value="%{'CAca'}" /> |
Another approach would be to use the idiom value="'CAca'"
, but, in this case, using the expression notation is recommended.
...
- All String attribute types are parsed for the "%{ ... }" notation.
- All non-String attribute types are not parsed, but evaluated directly as an expression
- The exception to rule #2 is that if the non-String attribute uses the escape notion "{%{}", the notation is ignored as redundant, and the content evaluated.
...
| A JavaBean object in a standard context in Freemarker, Velocity, or JSTL EL (Not OGNL). | ||
| A username property on the Value Stack. | ||
| Another way to refer to a property placed on the Value Stack. | ||
| The username property of the User object in the Session context. | ||
| A static Map, as in put("username","trillian"). |
...