...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Using an expression to set the label |
---|
|
<s:textfield labelkey="%{getText("postalCode.label")}" name="postalCode"/>
|
The expression language (OGNL) lets us call methods and evaluate properties. The method getText
is provided by ActionSupport, which is the base class for most Actions. Since the Action is on the stack, we can call any of its methods from an expression, including getText
.
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Evaluating booleans |
---|
|
<s:select labelkey="%{getText("state.label")}" name="state" multiple="true"/>
|
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Evaluating booleans (verbose) |
---|
|
<s:select labelkey="%{getText("state.label")}" name="state" multiple="%{true}"/>
|
Code Block |
---|
| xml |
---|
| xml |
---|
title | Evaluating booleans (with property) |
---|
|
<s:select labelkey="%{getText("state.label")}" name="state" multiple="allowMultiple"/>
|
Code Block |
---|
| xml |
---|
| xml |
---|
title | Evaluating booleans (verbose with property) |
---|
|
<s:select labelkey="%{getText("state.label")}" name="state" multiple="%{allowMultiple}"/>
|
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Probably wrong! |
---|
|
<s:textfield labelkey="%{getText("state.label")}" name="state" value="CA"/>
|
...
Code Block |
---|
| xml |
---|
| xml |
---|
title | Passing a literal value the right way |
---|
|
<s:textfield labelkey="%{getText("state.label")}" name="state" value="%{'CA'}" />
|
...