[ https://issues.apache.org/jira/browse/MYFACES-3299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13103170#comment-13103170 ]
Kennard Consulting commented on MYFACES-3299: --------------------------------------------- Okay, that makes sense. Thanks for your clarification. Can you please elaborate on 'check the conditions'? I believe JSF adds Bean Validation implicitly to components 'if a JSR 303 engine is present'. But how is that determined? Is there a JSF API? Or does MyFaces look for a specific JSR 303 class? > Programmatically generated components do not register with Bean Validation > -------------------------------------------------------------------------- > > Key: MYFACES-3299 > URL: https://issues.apache.org/jira/browse/MYFACES-3299 > Project: MyFaces Core > Issue Type: Bug > Reporter: Kennard Consulting > Attachments: jsf-validation.zip > > > I am having problems using MyFaces with Bean Validation. > I am not clear what the JSF spec means, but it says "Consider a simple web > application that has one page, written in Facelets for JSF 2, that has a > several text fields inside of a form. This application is running in a JSF > runtime in an environment that does require JSR 303 Bean Validation, and > therefore this feature is available. Assume that every text field is bound to > a managed bean property that has at least one Bean Validation constraint > annotation attached to it. During the render response phase that always > precedes a postback, due to the specification requirements in Section 3.5.3 > "Validation Registration", every UIInput in this application has an instance > of Validator with id javax.faces.Bean attached to it". > George Gastaldi and I have created a sample application (attached) that > demonstrates several ways of creating a simple input text bound to Bean > Validation. This must be deployed to a Java EE 6 container (we tested against > JBoss AS 6). You will note the first two pages (Normal Facelets form, Binding > Component) work fine. When you click 'Click Me' to POSTback, Bean Validation > is invoked and a validation error is displayed. > The second two pages (Dynamic Component, Dynamic Component (with Metawidget)) > do not work as expected. They both use PreRenderViewEvent to create the > inputText programmatically. The spec is unclear whether we're meant to > explicitly add a javax.faces.Bean validator in this case? The way I read > section 3.5.3, I don't think we do, but it doesn't work without it? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira