[jboss-user] [JBoss Seam] - s:validateAll cumulates validation error messages when used
petr.mk
do-not-reply at jboss.com
Wed May 23 10:18:28 EDT 2007
Hello,
does anyone meet the same problem?
When <s:validateAll> tag is used in form together with dispalying error messahes using <h:messages globalOnly="false"/>, then the same validation message for one input form is cumulated. After first submit (in form is only one input field!) can be seen:
length must be between 10 and 255
length must be between 10 and 255
after second submit:
length must be between 10 and 255
length must be between 10 and 255
length must be between 10 and 255
etc.
It looks like <s:validateAll> problem, because when <s:validate/> is used, all is O.K.
Here is test example:
BookDetailTest.xhtml:
<!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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib">
#{libraryMessages.border_facelets_library}
<meta http-equiv="Content-type" content="text/html; charset=windows-1250" />
<meta http-equiv="Content-Language" content="cs" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<f:view>
<h:messages globalOnly="false" />
<h:form id="saveform">
<s:validateAll>
<h:panelGrid columns="2" border="0" cellpadding="0" cellspacing="2">
<f:facet name="header">
<h:outputText id="bookDetail_book" value="#{libraryMessages.bookDetail_kniha}" />
</f:facet>
<f:facet name="aroundInvalidField">
<s:span styleClass="error"/>
</f:facet>
<f:facet name="afterInvalidField">
<h:outputText value=" *)" />
</f:facet>
<h:outputText id="bookDetail_author" value="#{libraryMessages.bookDetail_autor}" />
<s:decorate id="author">
<h:inputText type="text"
label="#{libraryMessages.bookDetail_autor}"
value="#{bookDetailBean.author}"
required="true"
size="30"
maxlength="30" />
</s:decorate>
<f:facet name="footer">
<h:panelGroup>
<h:commandButton type="submit"
id="savebutton"
action="save"
value="#{libraryMessages.bookDetail_ulozit}" />
<h:commandButton type="submit"
id="backbutton"
action="back"
immediate="true"
value="#{libraryMessages.bookDetail_zpet}" />
</h:panelGroup>
</f:facet>
</h:panelGrid>
</s:validateAll>
</h:form>
</f:view>
BookDetailTestBean.java:
package cz.profinit.education.library.web.beans;
import java.io.Serializable;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;
/**
*
* Book detail implementation class.
*
* @author $Author: pmarek $
* @version $Revision: 1.0 $
*/
@Name("bookDetailTestBean")
public class BookDetailTestBean extends LibraryBaseBean implements Serializable {
private static final long serialVersionUID = -1547896425866324414L;
private String author;
@NotNull
@Length(min = 10, max = 255)
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
/**
* SaveBookListener.
* @ cycle
*/
public String save() {
return "success";
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047915#4047915
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047915
More information about the jboss-user
mailing list