更新时间:2023-11-27 21:43:28
您基本上需要将autocomplete="off"
属性添加到HTML <form>
元素中.但是,<h:form>
不支持此属性.仅单个<h:inputText>
和<h:inputSecret>
组件支持.
You basically need to add autocomplete="off"
attribute to the HTML <form>
element. However, this attribute is not supported on the <h:form>
. It's only supported on the individual <h:inputText>
and <h:inputSecret>
components.
所以,这应该做:
<h:form>
<h:inputText value="#{auth.username}" required="true" autocomplete="off" />
<h:inputSecret value="#{auth.password}" required="true" autocomplete="off" />
<h:commandButton value="Login" action="#{auth.login}" />
<h:messages />
</h:form>
<h:form>
上新的autocomplete
属性计划用于JSF 2.2.另请参见 JSF规范问题418 .
The new autocomplete
attribute on <h:form>
is scheduled for JSF 2.2. See also JSF spec issue 418.
或者,如果您正在使用j_security_check
的容器管理登录名,无论如何,该登录名都需要普通的HTML <form>
,则只需将其添加到其中:
Or, if you're using container managed login with j_security_check
which requires a plain vanilla HTML <form>
anyway, then just add it in there:
<form action="j_security_check" method="post" autocomplete="off">
<input type="text" name="j_username" />
<input type="password" name="j_password" />
<input type="submit" value="Login" />
</form>
<h:inputText>
标记文档(提及autocomplete
属性)<h:inputSecret>
标记文档(提及autocomplete
属性)
<h:inputText>
tag documentation (mentions autocomplete
attribute)<h:inputSecret>
tag documentation (mentions autocomplete
attribute)