![](/img/trans.png)
[英]javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL does not work anymore since Java EE 7 / EL 3.0
[英]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
在 web.xml javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
中設置。 JSF 2.2 版本工作正常,切換到 WildFly 16 這種不同的行為。 一個簡單的例子如下:
使用說明:訪問: http://localhost:8080/primefaces-test/?tipo=U&test=Bah點擊第一個按鈕,點擊第二個按鈕。 ajax 后,bean 中的 viewParam 值為空,即使它填充在 url 中。
示例項目(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 中等待正式發布
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.