001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kns.web.taglib.html;
017    
018    import org.apache.commons.lang.StringUtils;
019    import org.apache.struts.action.ActionForm;
020    import org.apache.struts.taglib.html.PasswordTag;
021    import org.kuali.rice.kns.util.WebUtils;
022    import org.kuali.rice.kns.web.struts.form.pojo.PojoForm;
023    
024    import javax.servlet.jsp.JspException;
025    
026    /**
027     * This is a description of what this class does - wliang don't forget to fill this in. 
028     * 
029     * @author Kuali Rice Team (rice.collab@kuali.org)
030     *
031     */
032    public class KNSPasswordTag extends PasswordTag {
033    
034            /**
035             * @see org.apache.struts.taglib.html.BaseFieldTag#doEndTag()
036             */
037            @Override
038            public int doEndTag() throws JspException {
039                    int returnVal = super.doEndTag();
040                    if (!getDisabled() && !getReadonly()) {
041                    String name = prepareName();
042                    if (StringUtils.isNotBlank(name)) {
043                            ActionForm form = WebUtils.getKualiForm(pageContext);
044                        if(form!=null && form instanceof PojoForm) {
045                            ((PojoForm) form).registerEditableProperty(name);
046                        }
047                    }
048                }
049                    return returnVal;
050            }
051            
052    }