代码之家  ›  专栏  ›  技术社区  ›  erickdeoliveiraleal

使用javax.faces.exploration_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL会导致viewParam为NULL

  •  0
  • erickdeoliveiraleal  · 技术社区  · 7 年前

    我正在尝试将一个应用程序从WildFly 13(JavaEE7,JSF2.2.15)切换到WildFly 16(JavaEE8,JSF2.3.9)。尝试了PrimeFaces 6.2和7.0

    在web.xml中 javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL 一切就绪。

    访问: http://localhost:8080/primefaces-test/?tipo=U&test=Bah

    https://github.com/erickdeoliveiraleal/primefaces-test/tree/update

     <!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;
        }
    
    }
    
    0 回复  |  直到 7 年前
        1
  •  0
  •   erickdeoliveiraleal    5 年前

    修正了WildFly 21 https://github.com/eclipse-ee4j/mojarra/issues/4550 仍然在等待eclipse-ee4j的正式发布