我正在尝试将应用程序从 WildFly 13(Java EE 7、JSF 2.2.15)切换到 WildFly 16(Java EE 8、JSF 2.3.9)。尝试了 PrimeFaces 6.2 和 7.0
在 web.xml 中javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
已设置。
JSF 2.2 版本工作正常,切换到 WildFly 16 这种不同的行为。一个简单的例子如下:
指示:
使用权:单击第一个按钮,单击第二个按钮。 ajax之后,bean中的viewParam值为null,即使它被填充在url中。
示例项目(码头):https://github.com/erickdeoliveiraleal/primefaces-test/tree/update 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>
Bean
@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 https://github.com/eclipse-ee4j/mojarra/issues/4550并且仍在 eclipse-ee4j 中等待正式发布
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)