How to disable autocomplete for Struts tags(HTML:text)

后端 未结 5 981
抹茶落季
抹茶落季 2021-01-25 17:09

For normal HTML input tag,disabling autocomplete is simple as given below:


Whe

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-25 17:41

    Another option is to write your Own TextTag class something like this:

    public class TextTagNoAutoComplete extends BaseFieldTag {
        public TextTagNoAutoComplete() {
             super();
             this.type = "text";
             doReadonly = true;
        }
        protected void prepareOtherAttributes(StringBuffer handlers) {
             prepareAttribute(handlers, "autocomplete", "false");
        }
    }
    

    and point textnac to this class in your tld mapping! ..and Viola ! Not the best reusable code. Provided the fact that, Struts 1.x is in no way going to be revisited, this sortta monkey patching is more than enough in my point of view :)

提交回复
热议问题