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

查看:18
本文介绍了如何做自动完成=“关闭"在 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>

如果您不这样做,请不要忘记将 xmlns:f="http://xmlns.jcp.org/jsf/core" 添加到您的 head 属性中'没有.

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方式看起来很丑).

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

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天全站免登陆