voyent
Custom Message (custom validator) - 1.6.0-DR2 BUG?  XML
Forum Index -> General Help
Author Message
rangelmp

Joined: 14/Dec/2006 00:00:00
Messages: 26
Offline


Update:

I think that`s a bug in icefaces 1.6.0-DR2.
Using icefaces 1.5.3 this source work perfect, but when i change the
jar file i get the java.lang.ClassCastException error.
 




I try to build a custom validator that throw a new message error. I use the "Validating and Converting User Input With the JSF Framework" article but this don´t work for me. When i try to throw new ValidatorException, it´s return a error.

Error:

16:43:08,375 ERROR [D2DFaceletViewHandler] Problem in renderResponse: java.util.Vector
java.lang.ClassCastException: java.util.Vector
 


faces-config
Code:
 <validator>
         <validator-id>validacao</validator-id>
 <validator-class>br.com.wapcash.application.view.component.ValidatorUtil</validator-class>
     </validator>
 


ValidatorUtil
Code:
 public class ValidatorUtil implements Validator {
 
     static {
         System.out.println("Validator OK!");
         
     }
     public void validate(FacesContext facesContext, UIComponent component, Object value) {
         if (((String)value).length() > 7){
           
             FacesMessage message = new FacesMessage("Entrada maior que o limite");
           throw new ValidatorException(message);
       } else {
           System.out.println("PODE SALVAR =]");
       }
     }
 }
 


Also i try in the validate method:
Code:
 public void validate(FacesContext facesContext, UIComponent component, Object value) {
         if (((String)value).length() > 7){
             FacesMessage message = new FacesMessage();
             message.setDetail("teste");
             message.setSummary("teste");
             message.setSeverity(FacesMessage.SEVERITY_ERROR);
             throw new ValidatorException(message);
 ..........
 


and:
Code:
 FacesMessage messages = new FacesMessage("Entrada maior que o limite");
           facesContext.addMessage(component.getClientId(facesContext), messages);
 


In my jsf file:
Code:
 <ice:inputText id="xx" value="#{banco.descricao}" maxlength="20" required="true" rendered="#{banco.edit}">
 <validator validatorId="validacao" />
 </ice:inputText>
 

rangelmp

Joined: 14/Dec/2006 00:00:00
Messages: 26
Offline


Anyone can confirm this bug?
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team