[jboss-user] [JBoss Seam] - @Validator causing EntityHome.managed equal false
hstang
do-not-reply at jboss.com
Wed Jun 6 11:29:31 EDT 2007
Does anyone know why throwing a ValidatorException in annotated @Validator classes would cause EntityHome.managed false? Other validation errors would not cause the managed property to be false except for those matched by @Validator classes. In the code I provide below, after you enter "false" in the input text box, the button update button would disappear upon refresh because the managed property is set to false.
## sheep.xhtml
| <h:form>
| <f:facet name="afterInvalidField">
| <s:message/>
| </f:facet>
|
| <s:validateAll>
| <s:decorate>
| <h:inputText value="#{sheepHome.instance.name}"
| required="true"
| validator="testValidator"/>
| </s:decorate>
| </s:validateAll>
|
| <h:commandButton action="#{sheepHome.update}"
| value="Update"
| rendered="#{sheepHome.managed}"/>
| </h:form>
|
## sheep.page.xml
| <page>
|
| <begin-conversation join="true"/>
|
| <param name="id" value="#{sheepHome.id}" converterId="javax.faces.Long"/>
|
| </page>
|
## TestValidator.java
| @Name("testValidator")
| @Validator
| public class TestValidator extends EntityController
| implements javax.faces.validator.Validator, Serializable {
|
| public void validate(FacesContext facesContext, UIComponent uiComponent, Object object) throws ValidatorException {
| if ("false".equals((String) object)) throw new ValidatorException(new FacesMessage("Managed is false"));
| }
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051781#4051781
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051781
More information about the jboss-user
mailing list