01: package com.opensymphony.webwork.components;
02:
03: import com.opensymphony.xwork.util.OgnlValueStack;
04:
05: import javax.servlet.http.HttpServletRequest;
06: import javax.servlet.http.HttpServletResponse;
07:
08: /**
09: * <!-- START SNIPPET: javadoc -->
10: * Renders two HTML select elements with second one changing displayed values depending on selected entry of first one.
11: * <!-- END SNIPPET: javadoc -->
12: *
13: * <p/> <b>Examples</b>
14: *
15: * <pre>
16: * <!-- START SNIPPET: example -->
17: * <ww:doubleselect label="doubleselect test1" name="menu" list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
18: * <ww:doubleselect label="doubleselect test2" name="menu" list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
19: * <!-- END SNIPPET: example -->
20: * </pre>
21: *
22: * @author Patrick Lightbody
23: * @author Rene Gielen
24: * @version $Revision: 2842 $
25: * @since 2.2
26: *
27: * @ww.tag name="doubleselect" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.DoubleSelectTag"
28: * description="Renders two HTML select elements with second one changing displayed values depending on selected entry of first one."
29: */
30: public class DoubleSelect extends DoubleListUIBean {
31: final public static String TEMPLATE = "doubleselect";
32:
33: public DoubleSelect(OgnlValueStack stack,
34: HttpServletRequest request, HttpServletResponse response) {
35: super (stack, request, response);
36: }
37:
38: protected String getDefaultTemplate() {
39: return TEMPLATE;
40: }
41:
42: public void evaluateExtraParams() {
43: super .evaluateExtraParams();
44:
45: // force the onchange parameter
46: addParameter("onchange", getParameters().get("id")
47: + "Redirect(this.options.selectedIndex)");
48: }
49: }
|