Value Stack (VS) is a robust utility class that supports WW's expression language (EL). Through its findValue and test methods, it evaluates value and conditional expressions respectively. VS provides the plumbing for EL. It possesses the ability to traverse the stack and flatten out objects retrieving the desired data.
Listed below is a partial list of examples of how clients use the VS to meet their needs.
Once an object is in the stack, you access their values via the EL syntax. See reference section for more details on EL.
Object findValue(String query)
This method is used to retrieve a value from the VS given an EL query. The query is segmented and each segment in turn is evaluated. This evaluation may walk the stack for the appropriate object and then call appropriate methods to retrieve the desired value. The result will be either an object or null.
boolean test(String test)
This method is used to resolve a conditional expression statement. The conditional tags if and elseIf will call this method to evaluate its conditional statement.
ValueHolder (VH)
VH is an interface you may implement that allows you to perform lazy evaluation of your object when VS finds it. For instance, you can create an anonymous class that implements VH and push that class on the stack. When someone finds the object, VS will call getValue() on the class and return the value.
ValueStack getStack(PageContext context)
Retrieve the ValueStack for this PageContext. If none is found, then one will be created. There is only one stack per PageContext. Any tag needing a VS will call this method.
ValueStack getStack(ServletRequest request)
Retrieve the ValueStack for this ServletRequest. If none is found, then one will be created. There is only one stack per ServletRequest. Any servlet dispatcher needing a VS will call this method.
Object popValue()
Pop an object off the stack. The object is returned. If the stack is empty, null is returned.
void pushValue(Object value)
Push an object on the stack.