craigmcc    01/02/13 16:39:53

  Modified:    src/doc  struts-html.xml
               src/share/org/apache/struts/taglib/html BaseFieldTag.java
               web/example logon.jsp
  Log:
  Partially restore the previous operation of the <html:password> tag.
  
  Now, the <html:password> tag redisplays the existing contents of the
  underlying property (echoed as asterisks on the HTML page, but visible in
  the underlying page source) by default, in a manner consistent with the
  way all other input fields redisplay their contents.  However, you can
  turn this redisplay off (as would be appropriate on a login page):
  
        <html:password property="password" redisplay="false"/>
  
  Revision  Changes    Path
  1.11      +17 -0     jakarta-struts/src/doc/struts-html.xml
  
  Index: struts-html.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- struts-html.xml   2001/02/13 18:42:57     1.10
  +++ struts-html.xml   2001/02/14 00:39:51     1.11
  @@ -2781,6 +2781,23 @@
                        </info>
                </attribute>
                
  +                <attribute>
  +                        <name>redisplay</name>
  +                        <required>false</required>
  +                        <rtexprvalue>true</rtexprvalue>
  +                        <info>
  +                        Boolean flag indicating whether or not existing values
  +                        will be redisplayed if they exist.  Even though the
  +                        redisplayed value will be shown as asterisks on the
  +                        visible HTML page, the cleartext of the actual password
  +                        value will be visible though the "Show Page Source"
  +                        menu option of the client browser.  You may wish to
  +                        set this value to <code>false</code> on login pages.
  +                        Defaults to <code>true</code> for consistency with
  +                        all other form tags that redisplay their contents.
  +                        </info>
  +                </attribute>
  +
                <attribute>
                        <name>style</name>
                        <required>false</required>
  
  
  
  1.4       +30 -6     
jakarta-struts/src/share/org/apache/struts/taglib/html/BaseFieldTag.java
  
  Index: BaseFieldTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseFieldTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BaseFieldTag.java 2001/02/01 00:48:07     1.3
  +++ BaseFieldTag.java 2001/02/14 00:39:52     1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseFieldTag.java,v 
1.3 2001/02/01 00:48:07 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/02/01 00:48:07 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/BaseFieldTag.java,v 
1.4 2001/02/14 00:39:52 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/14 00:39:52 $
    *
    * ====================================================================
    *
  @@ -71,15 +71,17 @@
   import javax.servlet.jsp.tagext.TagSupport;
   import org.apache.struts.upload.FormFile;
   import org.apache.struts.util.BeanUtils;
  -import org.apache.struts.util.PropertyUtils;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.PropertyUtils;
  +import org.apache.struts.util.RequestUtils;
  +import org.apache.struts.util.ResponseUtils;
   
   
   /**
    * Convenience base class for the various input tags for text fields.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/02/01 00:48:07 $
  + * @version $Revision: 1.4 $ $Date: 2001/02/14 00:39:52 $
    */
   
   public abstract class BaseFieldTag extends BaseInputTag {
  @@ -120,6 +122,20 @@
   
   
       /**
  +     * The "redisplay contents" flag (used only on <code>password</code>).
  +     */
  +    protected boolean redisplay = true;
  +
  +    public boolean getRedisplay() {
  +        return (this.redisplay);
  +    }
  +
  +    public void setRedisplay(boolean redisplay) {
  +        this.redisplay = redisplay;
  +    }
  +
  +
  +    /**
        * The type of input field represented by this tag (text, password, or
        * hidden).
        */
  @@ -170,7 +186,8 @@
        results.append(" value=\"");
        if (value != null) {
            results.append(BeanUtils.filter(value));
  -     } else if (!"password".equals(type)) {
  +     } else if (redisplay || !"password".equals(type)) {
  +            /*
            Object bean = pageContext.findAttribute(name);
            if (bean == null)
                throw new JspException
  @@ -199,6 +216,12 @@
                throw new JspException
                    (messages.getMessage("getter.method", property, name));
            }
  +            */
  +            Object value = RequestUtils.lookup(pageContext, name, property,
  +                                               null);
  +            if (value == null)
  +                value = "";
  +            results.append(ResponseUtils.filter(value.toString()));
        }
        results.append("\"");
        results.append(prepareEventHandlers());
  @@ -228,6 +251,7 @@
        super.release();
        accept = null;
        name = Constants.BEAN_KEY;
  +        redisplay = true;
   
       }
   
  
  
  
  1.16      +2 -1      jakarta-struts/web/example/logon.jsp
  
  Index: logon.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/example/logon.jsp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- logon.jsp 2001/01/27 23:31:14     1.15
  +++ logon.jsp 2001/02/14 00:39:52     1.16
  @@ -28,7 +28,8 @@
         <bean:message key="prompt.password"/>
       </th>
       <td align="left">
  -      <html:password property="password" size="16" maxlength="16"/>
  +      <html:password property="password" size="16" maxlength="16"
  +                    redisplay="false"/>
       </td>
     </tr>
   
  
  
  

Reply via email to