KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > field > PasswordFieldTag


1 package fr.improve.struts.taglib.layout.field;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import org.apache.struts.taglib.html.BaseHandlerTag;
6 import org.apache.struts.taglib.html.PasswordTag;
7 /**
8  * A simple password tag.
9  * @author: Jean-Noël Ribette
10  */

11 public class PasswordFieldTag extends AbstractFieldTag {
12     PasswordTag passwordFieldTag = new org.apache.struts.taglib.html.PasswordTag();
13     protected boolean redisplay = false;
14 protected boolean doBeforeValue() throws javax.servlet.jsp.JspException JavaDoc {
15     fieldTag = passwordFieldTag;
16     return true;
17 }
18     public boolean getRedisplay() {
19         return redisplay;
20     }
21 /**
22  * Insert the method's description here.
23  * Creation date: (01/12/2001 02:12:55)
24  * @return boolean
25  */

26 public boolean isRedisplay() {
27     return redisplay;
28 }
29     public void release() {
30         super.release();
31         redisplay = false;
32     }
33 /**
34  * Insert the method's description here.
35  * Creation date: (01/12/2001 02:12:55)
36  * @param newRedisplay boolean
37  */

38 public void setRedisplay(boolean newRedisplay) {
39     redisplay = newRedisplay;
40 }
41 /**
42  * Return the value(s) that will be displayed. The password should of course not been displayed, except specificaly asked.
43  */

44 protected java.lang.Object JavaDoc getFieldValue() throws JspException JavaDoc {
45     Object JavaDoc lc_value = super.getFieldValue();
46     switch (getFieldDisplayMode()) {
47         case MODE_EDIT:
48             if (!redisplay) {
49                 lc_value = "";
50             }
51             break;
52         default:
53             lc_value = "";
54     }
55     return lc_value;
56 }
57     
58     protected void copyProperties(BaseHandlerTag in_dest) throws JspException JavaDoc {
59         super.copyProperties(in_dest);
60         passwordFieldTag.setCols(getCols());
61         passwordFieldTag.setMaxlength(getMaxlength());
62         passwordFieldTag.setProperty(getProperty());
63         passwordFieldTag.setRows(getRows());
64         passwordFieldTag.setValue(getValue());
65         
66         passwordFieldTag.setAccept(getAccept());
67         passwordFieldTag.setName(getName());
68         passwordFieldTag.setRedisplay(getRedisplay());
69     }
70
71 }
72
Popular Tags