如何完成自动完成=“关闭"在JSF中处于表单级别 [英] how to do autocomplete="off" at form level in JSF

查看:70
本文介绍了如何完成自动完成=“关闭"在JSF中处于表单级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JSF中如何在表单级别执行autocomplete ="off"?

how to do autocomplete="off" at form level in JSF?

推荐答案

做到这一点的最佳和最简单的方法是:

The best and easiest way of doing this is this:

<h:form id="myForm">
    <f:passThroughAttribute name="autocomplete" value="off"/>
    ...
</h:form>

如果还没有,请不要忘记在head属性中添加xmlns:f="http://xmlns.jcp.org/jsf/core".

Don't forget to add xmlns:f="http://xmlns.jcp.org/jsf/core" to your head attribite if you don't have already.

为什么?

  1. 因为如果页面中某个地方需要更新/呈现表单的ajax事件,它不会丢失autocomplete属性.
  2. 因为它看起来很性感(JS方式看起来很丑).
  1. Because if you have an ajax event somewhere in your page that needs to update/render your form, it will not loose the autocomplete attribute.
  2. Because it looks sexy (JS way looks ugly).

提示:您可以对每个JSF元素使用f:passThroughAttribute,而JSF元素没有较新的HTML规范的任何特定属性.

Tip: You can use f:passThroughAttribute for every JSF element which does not have any specific attribute of newer HTML specifications.

这篇关于如何完成自动完成=“关闭"在JSF中处于表单级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆