1 7 package com.inversoft.verge.mvc.view.jsp.html; 8 9 10 import java.io.IOException ; 11 12 import javax.servlet.jsp.JspException ; 13 14 import org.apache.log4j.Logger; 15 16 import com.inversoft.util.ObjectTools; 17 import com.inversoft.verge.mvc.view.HtmlViewToolkit; 18 19 20 27 public class PasswordTag extends TextTag { 28 29 32 private static final Logger logger = Logger.getLogger(PasswordTag.class); 33 34 private boolean showPassword = false; 35 36 37 42 public boolean getShowPassword() { 43 return showPassword; 44 } 45 46 51 public void setShowPassword(boolean showPassword) { 52 this.showPassword = showPassword; 53 } 54 55 56 64 public int doStartTag() throws JspException { 65 66 initialize(); 68 69 StringBuffer buf = new StringBuffer (); 70 createPasswordTag(buf, getId(), localName, localValue); 71 72 if (logger.isDebugEnabled()) { 73 logger.debug("The password tag: " + buf.toString()); 74 } 75 76 try { 77 pageContext.getOut().print(buf.toString()); 78 } catch (IOException ioe) { 79 throw new JspException (ioe.toString()); 80 } 81 82 return SKIP_BODY; 83 } 84 85 99 protected void createPasswordTag(StringBuffer buf, String id, String name, 100 Object value) 101 throws JspException { 102 String valueStr = null; 103 if (showPassword) { 104 valueStr = ObjectTools.toString(value); 105 } 106 107 HtmlViewToolkit.createPasswordTag(buf, id, name, valueStr, attributes, 108 singleAttrs); 109 } 110 } | Popular Tags |