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