s:validateAll does not work, s:validate does. Why?
jaulich Sep 26, 2006 9:50 AMI try to use the s:validateAll tag in conjunction with ADF Faces and Faclets, but it does not work. I get an an uncought exception. If I try to use s:validate on the specific tags it works as I want.
Did I do something wrong or is it a bug?
Here my JSP that does not work:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:af="http://xmlns.oracle.com/adf/faces" xmlns:afh="http://xmlns.oracle.com/adf/faces/html" template="template.xhtml"> <ui:define name="content"> <af:form> <af:messages/> <af:commandButton text="Neu" action="#{contracttypeAction.create}" rendered="#{!contracttypeAction.editMode}"/> <af:commandButton text="Bearbeiten" action="#{contracttypeAction.edit}" rendered="#{(!contracttypeAction.editMode) and (contracttypeAction.loadedEntity)}"/> <af:commandButton text="Save" action="#{contracttypeAction.save}" rendered="#{contracttypeAction.editMode}"/> <af:commandButton text="Cancel" action="#{contracttypeAction.cancel}" rendered="#{contracttypeAction.editMode}" immediate="true"/> <af:panelGroup rendered="#{(contracttypeAction.editMode) or (contracttypeAction.loadedEntity)}" layout="horizontal"> <s:validateAll> <table> <tr> <td> <af:outputLabel for="value" value="Bezeichnung:"/> </td> <td> <af:inputText id="value" readOnly="#{!contracttypeAction.editMode}" required="true" showRequired="false" value="#{contracttype.value}"/> </td> <td> <af:message for="value"/> </td> </tr> <tr> <td> <af:outputLabel for="orderNumber" value="Gliederungsnummer:"/> </td> <td> <af:inputText id="orderNumber" readOnly="#{!contracttypeAction.editMode}" required="tue" value="#{contracttype.orderNumber}" /> </td> <td> <af:message for="orderNumber"/> </td> </tr> </table> </s:validateAll> </af:panelGroup> </af:form> </ui:define> </ui:composition>
This one works fine (e.g. when I enter more than 40 characters in the orderNumber field, see entity bean):
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:af="http://xmlns.oracle.com/adf/faces" xmlns:afh="http://xmlns.oracle.com/adf/faces/html" template="template.xhtml"> <ui:define name="content"> <af:form> <af:messages/> <af:commandButton text="Neu" action="#{contracttypeAction.create}" rendered="#{!contracttypeAction.editMode}"/> <af:commandButton text="Bearbeiten" action="#{contracttypeAction.edit}" rendered="#{(!contracttypeAction.editMode) and (contracttypeAction.loadedEntity)}"/> <af:commandButton text="Save" action="#{contracttypeAction.save}" rendered="#{contracttypeAction.editMode}"/> <af:commandButton text="Cancel" action="#{contracttypeAction.cancel}" rendered="#{contracttypeAction.editMode}" immediate="true"/> <af:panelGroup rendered="#{(contracttypeAction.editMode) or (contracttypeAction.loadedEntity)}" layout="horizontal"> <table> <tr> <td> <af:outputLabel for="value" value="Bezeichnung:"/> </td> <td> <af:inputText id="value" readOnly="#{!contracttypeAction.editMode}" required="true" showRequired="false" value="#{contracttype.value}"> <s:validate/> </af:inputText> </td> <td> <af:message for="value"/> </td> </tr> <tr> <td> <af:outputLabel for="orderNumber" value="Gliederungsnummer:"/> </td> <td> <af:inputText id="orderNumber" readOnly="#{!contracttypeAction.editMode}" required="tue" value="#{contracttype.orderNumber}"> <s:validate/> </af:inputText> </td> <td> <af:message for="orderNumber"/> </td> </tr> </table> </af:panelGroup> </af:form> </ui:define> </ui:composition>
My entity bean:
package de.cogitum.contra.model; import static org.jboss.seam.ScopeType.CONVERSATION; import javax.persistence.Entity; import org.hibernate.validator.Length; import org.hibernate.validator.NotNull; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; @Entity @Name("contracttype") @Scope(CONVERSATION) public class ContractType extends Taxonomy { private static final long serialVersionUID = 1530145534100005653L; private String orderNumber; @NotNull @Length(min=1, max=40) public String getOrderNumber() { return orderNumber; } public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; } }
Any idea? My understanding of the Seam validation tags is that I can use both. Am I wrong?