使用 javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL 导致 viewParam 为空 [英] using javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL causes viewParam to be null
问题描述
我正在尝试将应用程序从 WildFly 13(Java EE 7、JSF 2.2.15)切换到 WildFly 16(Java EE 8、JSF 2.3.9).尝试了 PrimeFaces 6.2 和 7.0
I'm trying to switch an application from WildFly 13 (Java EE 7, JSF 2.2.15) to WildFly 16 (Java EE 8, JSF 2.3.9). Tried both PrimeFaces 6.2 and 7.0
在 web.xml javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
中设置.JSF 2.2 版本工作正常,切换到 WildFly 16 这种不同的行为.一个简单的例子如下:
In web.xml javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
is set.
JSF 2.2 version working fine, switching to WildFly 16 this different behavior. A simple example follows:
说明:访问:http://localhost:8080/primefaces-test/?tipo=U&test=呸单击第一个按钮,单击第二个按钮.ajax后bean中的viewParam值为null,即使是在url中填充.
Instructions: access: http://localhost:8080/primefaces-test/?tipo=U&test=Bah click first button, click second button. after ajax the viewParam value in the bean is null, even it is filled within the url.
示例项目(Jetty):https://github.com/erickdeoliveiraleal/primefaces-测试/树/更新
Sample project (Jetty): https://github.com/erickdeoliveiraleal/primefaces-test/tree/update
XHTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html">
<f:metadata>
<f:viewParam name="test" value="#{testView.testString}" />
<f:viewAction action="#{testView.inicializar}" />
</f:metadata>
<h:head>
<title>PrimeFaces Test</title>
</h:head>
<h:body>
<h:form id="cadastro">
<h:commandButton value="click me"
action="#{testView.inserirNaLista()}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<p:commandButton
value="click me - 2 (this button causes the null value)"
action="#{testView.inserirNaLista()}" />
</h:form>
</h:body>
</html>
豆
@ManagedBean(name = "testView")
@ViewScoped
public class TestView implements Serializable {
private String testString;
public void inicializar() {
System.out.println("initializing: " + testString);
}
public void inserirNaLista() {
System.out.println(testString);
}
public String getTestString() {
return testString;
}
public void setTestString(String testString) {
this.testString = testString;
}
}
推荐答案
已在 WildFly 21 中修复 https://github.com/eclipse-ee4j/mojarra/issues/4550 并且仍在 eclipse-ee4j 中等待正式发布
fixed in WildFly 21 https://github.com/eclipse-ee4j/mojarra/issues/4550 and still pending official release in eclipse-ee4j
这篇关于使用 javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL 导致 viewParam 为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!