1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.struts2.components;
22
23 import javax.servlet.http.HttpServletRequest;
24 import javax.servlet.http.HttpServletResponse;
25
26 import org.apache.struts2.views.annotations.StrutsTag;
27
28 import com.opensymphony.xwork2.util.ValueStack;
29
30 /***
31 * <!-- START SNIPPET: javadoc -->
32 * Renders two HTML select elements with second one changing displayed values depending on selected entry of first one.
33 * <!-- END SNIPPET: javadoc -->
34 *
35 * <p/> <b>Examples</b>
36 *
37 * <pre>
38 * <!-- START SNIPPET: example -->
39 * <s:doubleselect label="doubleselect test1" name="menu" list="{'fruit','other'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
40 * <s:doubleselect label="doubleselect test2" name="menu" list="#{'fruit':'Nice Fruits', 'other':'Other Dishes'}" doubleName="dishes" doubleList="top == 'fruit' ? {'apple', 'orange'} : {'monkey', 'chicken'}" />
41 * <!-- END SNIPPET: example -->
42 * </pre>
43 *
44 */
45 @StrutsTag(name="doubleselect", tldTagClass="org.apache.struts2.views.jsp.ui.DoubleSelectTag", description="Renders two HTML select elements with second one changing displayed values depending on " +
46 "selected entry of first one.")
47 public class DoubleSelect extends DoubleListUIBean {
48 final public static String TEMPLATE = "doubleselect";
49
50
51 public DoubleSelect(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
52 super(stack, request, response);
53 }
54
55 protected String getDefaultTemplate() {
56 return TEMPLATE;
57 }
58
59 public void evaluateExtraParams() {
60 super.evaluateExtraParams();
61
62
63 addParameter("onchange", getParameters().get("id") + "Redirect(this.options.selectedIndex)");
64 }
65 }