HTML and CSS Reference
In-Depth Information
Figure 6-3. The StateHolder and StateHelper classes
Storing and retrieving values using the StateHelper can be achieved using the put and eval methods as illustrated
in Listing 6-4.
Listing 6-4. Storing and Retrieving State Values Using the StateHelper
public void setTextType(String textType) {
// Store the textType value under the constant ATTR_TEXT_TYPE
getStateHelper().put(ATTR_TEXT_TYPE, textType);
public String getTextType() {
// Retrieve the value stored under the constant ATTR_TEXT_TYPE
return (String) getStateHelper().eval(ATTR_TEXT_TYPE);
public void setOutputTag(String outputTag) {
// Store the outputTag value under the constant ATTR_OUTPUT_TAG
getStateHelper().put(ATTR_OUTPUT_TAG, outputTag);
public String getOutputTag() {
// Retrieve the value stored under the constant ATTR_OUTPUT_TAG
// If the ATTR_OUTPUT_TAG constant could not be found, the value
// in the constant ATTR_OUTPUT_TAG_DEFAULT will be returned instead.
return (String) getStateHelper().eval(ATTR_OUTPUT_TAG, ATTR_OUTPUT_TAG_DEFAULT);
Search WWH ::

Custom Search