火狐覆盖javax.faces.ViewState与F5旧值,如何关闭自动完成 [英] Firefox overrides javax.faces.ViewState with old value on F5, how to turn off autocomplete

查看:1090
本文介绍了火狐覆盖javax.faces.ViewState与F5旧值,如何关闭自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JSF 2.1在Tomcat 7和Firefox中23.0.0.1打开它。

I am using JSF 2.1 on Tomcat 7 and opening it in Firefox 23.0.0.1.

页面生成一个 javax.faces.ViewState 隐藏输入字段预期:

The page generates a javax.faces.ViewState hidden input field as expected:

<input type="hidden" value="2442695108697186454:-4079620282104128276" id="javax.faces.ViewState" name="javax.faces.ViewState">

在按F5时,服务器发送 javax.faces.ViewState 一个新的ID,这是正确的。然而,火狐保持在隐藏的输入的旧值。其结果是,旧观点作用域的bean是采取Ajax请求。

When hitting F5, the server sends a new id for javax.faces.ViewState, which is correct. However, Firefox keeps the old value in the hidden input. The result is that the old view-scoped bean is taken on ajax requests.

只有当我强迫一个硬刷新由STRG / Ctrl + F5键,那么火狐需要从服务器的新的价值。我认为这是Firefox浏览器的功能(重新加载页面时,用表格的Firefox使我输入我经常看到)。

Only when I force a hard refresh by Strg/Ctrl+F5, then Firefox takes the new value from server. I think it's a feature of Firefox (I often see when reloading a page with a form Firefox keeps my inputs).

任何想法如何处理呢?我认为这是关系到<一个href=\"http://stackoverflow.com/questions/2486474/$p$pventing-firefox-from-remembering-the-input-value-on-refresh-with-meta-tag\">$p$pventing从Firefox的记忆与元标记刷新输入值,但我怎么把自动完成=关闭这个JSF生成隐藏的输入组件?

Any ideas how to deal with that? I think it's related to Preventing Firefox from remembering the input value on refresh with Meta tag, but how do I put autocomplete="off" on this JSF-generated hidden input component?

推荐答案

Mojarra增加已经默认自动完成=关闭来的视图状态隐藏字段,因为1.2版本。显然,你的web应用配置为禁用它,因为开发者担心的W3 HTML验证出于某种原因,或者HTTP响应主体是通过一些过激(X)HTML格式过滤器。在自动完成=关闭&LT;输入类型=隐藏&GT; 是即无效(X )HTML。

Mojarra adds already by default autocomplete="off" to the view state hidden field since version 1.2. Apparently your webapplication is configured to disable it because the developers were fearing the W3 HTML validator for some reason, or perhaps the HTTP response body is been passed through some overzealous (X)HTML formatting filter. The autocomplete="off" in an <input type="hidden"> is namely invalid in (X)HTML.

查找以下环境参数的web.xml 。如果它是present,摆脱它。它默认为真正了。

Look for the following context parameter in web.xml. If it's present, get rid of it. It defaults to true already.

<context-param>
    <param-name>com.sun.faces.autoCompleteOffOnViewState</param-name>
    <param-value>false</param-value>
</context-param>

或者,如果你确实有这样一个格式过滤器,看看它的文档中如何告诉它不删除(X)HTML的无效属性。

Or if you have indeed such a formatting filter, look in its documentation how to tell it to not remove (X)HTML-invalid attributes.

  • Mojarra issue 1129

这篇关于火狐覆盖javax.faces.ViewState与F5旧值,如何关闭自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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