Skip to main content

EL3.0 problem with null string

No replies
daiwang
Offline
Joined: 2003-06-10
Points: 0

web.xml set as below:

<context-param>
     <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
     <param-value>true</param-value>
</context-param>

test page code as below:

<h:body>
    <h:form>
        <h:inputText value="#{controller.name}" />
        <h:commandButton value="test" action="#{controller.test()}" />
        <h:outputText value="#{controller.name == null}" />
    </h:form>
</h:body>

test controller code as below:

@ViewScoped
public class Controller {
    private String name;
    public String getName() {
         return name;
    }
    public void setName(String strName) {
         this.name = strName;
    }
    public String test() {
          return "";
    }
}

when clear input text and click the test button,
on glassfish3.1.2, output true;
on glassfish4, output false;

Debug it, inputtext component's property as summitvale, localvalue, localvalueset all works well.
So, it's the EL 3.0 problem.

Change page code as:

<h:commandButton value="test" actionListener="#{controller.setName(null)}" action="#{controller.test}" />

When EL set name's value, it pass "" but not null.

Is it a problem with EL3.0 ?