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: * Render an HTML input tag of type password.</p>
11: * <!-- END SNIPPET: javadoc -->
12: *
13: * <p/> <b>Examples</b>
14: * <p/>
15: * <!-- START SNIPPET: exdescription -->
16: * In this example, a password control is displayed. For the label, we are calling ActionSupport's getText() to
17: * retrieve password label from a resource bundle.<p/>
18: * <!-- END SNIPPET: exdescription -->
19: * <pre>
20: * <!-- START SNIPPET: example -->
21: * <ww:password label="%{text('password')}" name="password" size="10" maxlength="15" />
22: * <!-- END SNIPPET: example -->
23: * </pre>
24: *
25: * @author Patrick Lightbody
26: * @author Rene Gielen
27: * @version $Revision: 2468 $
28: * @since 2.2
29: *
30: * @ww.tag name="password" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.PasswordTag"
31: * description="Render an HTML input tag of type password"
32: */
33: public class Password extends TextField {
34: final public static String TEMPLATE = "password";
35:
36: protected String showPassword;
37:
38: public Password(OgnlValueStack stack, HttpServletRequest request,
39: HttpServletResponse response) {
40: super (stack, request, response);
41: }
42:
43: protected String getDefaultTemplate() {
44: return TEMPLATE;
45: }
46:
47: public void evaluateExtraParams() {
48: super .evaluateExtraParams();
49:
50: if (showPassword != null) {
51: addParameter("showPassword", findValue(showPassword,
52: Boolean.class));
53: }
54: }
55:
56: /**
57: * Whether to show input
58: * @ww.tagattribute required="false" type="Boolean" default="false"
59: */
60: public void setShowPassword(String showPassword) {
61: this .showPassword = showPassword;
62: }
63:
64: /**
65: * Deprecated. Use showPassword instead.
66: * @ww.tagattribute required="false" rtexprvalue="true"
67: * @deprecated use {@link #setShowPassword(String)}
68: */
69: public void setShow(String showPassword) {
70: this.showPassword = showPassword;
71: }
72: }
|