2 Replies Latest reply on Nov 13, 2013 2:45 AM by Dominik M.

    Validation Exceptions for Composite Components

    Dominik M. Newbie

      Hi there,

       

      i am facing a problem while working with Composite Compontents which contains input fields.

      System: JSF 2.1.19-redhat-1, JBoss EAP 6.1

       

      Normally, Validation Exceptions (/ UpdateModelExceptions) based on wrong input, will result in a FacesMessage (if any "messages" Tag is present).

      With JSF 2.1.19-redhat-1, such exceptions will not be catched by the implementation and processes as FacesMessage if the input field is part of a Composite Component, instead the error is published as system exception on a new page. It seems that such errors inside composite component not recognize the existing messages-tag (displaying the error page is the default behaviour of the reference implemenation if no messages - tag is present and PROJECT_STAGE is "Production"

       

      Here a very simple example, which demonstrates the problem. This example works as expected with mojarra 2.1.27.

      Two input fields, which references a "Integer"-Value. non-numeric inputs in the "normal" field will result in the expected faces message, wrong inputs in the composite component will result in an error page.

       

       

      composite component (simpleInput.xhtml)

      <!DOCTYPE html>
      <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:cc="http://java.sun.com/jsf/composite">
      
      <ui:composition>
          <cc:interface>
              <cc:attribute name="valueAttribute" required="true" />
              <cc:editableValueHolder name="inputComp" targets="inputComp" />
          </cc:interface>
          <cc:implementation>
              <h:inputText id="inputComp" value="#{cc.attrs.valueAttribute}"/><br/>
              <h:message for="inputComp"/>
          </cc:implementation>
      </ui:composition>
      </html>
      
      

       

      usage

      <h:form id="content">
          <h:messages id="messages" />
      
          <h:inputText value="#{demoController.someIntValue}" />
          <custome:simpleInput valueAttribute="#{demoController.someIntValue}"/>
          <h:commandButton value="submit" />
      </h:form>
      
      

       

      Some ideas, what is going wrong? Some workarounds (besides to implement a own global exception handler)?

       

      Thanks a lot

      dm