6 Replies Latest reply: Nov 2, 2012 5:56 AM by gimbal2 RSS

    Bug with validation or rendering after validation failure (?)

      Can anyone confirm the behaviour on other J2EE containers that I will describe below ?

      h2. Environment:

      JBoss 7.1.1 (Brontes)
      JDK 1.7.0_06 32-bit
      Win7 64-bit
      17:40:44,365 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-13) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401)
      Below is the very simple test case:

      h2. 1) A very simple request-scoped bean:
      package test;
      import java.io.Serializable;
      import javax.faces.bean.ManagedBean;
      import javax.faces.bean.RequestScoped;
      import javax.validation.constraints.NotNull;
      public class RequestBean implements Serializable {
           private static final long serialVersionUID = 1L;
           @NotNull(message="Input 1 is required")
           private String input1;
           @NotNull(message="Input 2 is required")
           private String input2;
           public String getInput1() {
                return input1;
           public String getInput2() {
                return input2;
           public void setInput1(String input1) {
                this.input1 = input1;
           public void setInput2(String input2) {
                this.input2 = input2;
      h2. 2) A very simple test.xhtml page:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml"
             <h:panelGrid columns="2">
                 Input 1: <h:inputText value="#{requestBean.input1}" />
                 Input 2: <h:inputText value="#{requestBean.input2}" />
                 <h:commandButton id="submit" value="Submit"/><br/>
      h2. 3. web.xml contents:
      <?xml version="1.0"?>
      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-name>Faces Servlet</servlet-name>
      h2. 4. faces-config.xml contents:
      <?xml version="1.0" encoding="UTF-8"?>
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
      h2. 5. Contents of WEB-INF/lib:
      salvojo@AAS-AUD20901BL /cygdrive/c/jboss-as-7.1.1.Final/standalone
      $ ls -alt deployments/test.war/WEB-INF/lib/
      total 1384
      drwx------+ 1 Administrators Domain Users      0 Nov  2 17:40 ..
      drwx------+ 1 Administrators Domain Users      0 Nov  2 16:56 .
      -rwx------+ 1 Administrators Domain Users 393259 Nov  2 16:56 standard.jar
      -rwx------+ 1 Administrators Domain Users  21029 Nov  2 16:56 jstl.jar
      -rwx------+ 1 Administrators Domain Users  38015 Nov  2 16:56 commons-logging.jar
      -rwx------+ 1 Administrators Domain Users 139966 Nov  2 16:56 commons-digester.jar
      -rwx------+ 1 Administrators Domain Users 559366 Nov  2 16:56 commons-collections.jar
      -rwx------+ 1 Administrators Domain Users 188671 Nov  2 16:56 commons-beanutils.jar
      -rwx------+ 1 Administrators Domain Users  48742 Nov  2 16:56 common-annotations.jar
      h2. 6. The test case

      h4. 6.1 Open the test.jsf page with your browser

      h4. 6.2 Click on Submit WITHOUT specifying any values for both Input1 and Input2.

      Expected behaviour: Messages displayed that both input fields are required.
      Actual: As expected

      h4. 6.3 Supply values for both Input1 and Input2, then click Submit

      Expected behaviour: No validation messages displayed. Entered values remain in the input field
      Actual: As expected

      h4. 6.4 Remove input value for Input1, then click Submit

      Expected behaviour:
      Validation message that Input1 is required.
      Current value for Input1 remain blank.
      Previous value for Input2 remain in the input field.

      Actual: As expected

      h4. 6.5 Remove input value for Input2, then click Submit ( both Input fields are now blank )

      Expected behaviour:
      Validation message both input fields are required.
      Input value for Input1 remain blank.
      Input value for Input2 remain blank.

      h3. Actual ( NOT AS EXPECTED, see below )

      Validation message both input fields are required.
      Input value for Input1 remain blank.
      Input value for Input2 remain NON-blank. The previous value before it was blanked out and submitted is rendered / displayed on the page*