"[EMAIL PROTECTED]" wrote : 
  | Not sure, looks good to me....

What's strange is that validation with entity bean work really fine but not 
with stateful bean. To prove it I build an entity bean


  | @Entity
  | @Name("aBean")
  | public class ABean implements Serializable{
  |     ....
  |     @Length(max=10,message="the value field of entity ABean is 10 character 
max")
  |     public String getValue() {
  |             return value;
  |     }
  |         ...
  | }
  | 

I change the stateful bean HelloBean to integrate the entity and in the view I 
did this 

  |              <!--input for the entity bean-->
  |              <h:inputText id="aBean_value" required="true"
  |                                     value="#{aBean.value}">                 
            
  |                               <s:validate/>      
  |             </h:inputText>                          
  |             <h:message for="aBean_value"/>                
  |                 
  |                 <br/>
  |                 
  |                 <!--input for the stateful bean-->
  |                 <h:inputText id="value" required="true"
  |                          value="#{hello.value}">                            
 
  |                    <s:validate/>      
  |                 </h:inputText>                
  |                 <h:message for="value"/>
  | 

When I submit the form with two strings longer than 10 characters I've got the 
error message from the entity bean but not the error message from stateful bean.

However the two values are properly injected in either the stateful and the 
entity bean

Here is the code of HelloBean 

  | @Stateful 
  | @Name("hello")
  | public class HelloBean implements Hello {
  | 
  |     @Logger private Log log;
  |     
  |     @In FacesMessages facesMessages;
  |     
  |     @In(required=false) 
  |     @Out(required=false)
  |     private ABean aBean;
  |     
  |     
  |     private String value = "";
  |     
  |     @Length(max=10,message="the value field of  Stateful HelloBean is 10 
character max")
  |     public String getValue() {
  |             return value;
  |     }
  | 
  |     public void setValue(String value) {
  |             this.value = value;
  |     }
  | 
  |     public void sayHello()
  |      {
  |         
  |         log.info("hello.coucou() action called for entity bean aBean with: 
#{aBean.value}, and the value attached to the HelloBean is #{hello.value}");
  |         facesMessages.add("value of aBean #{aBean.value} value of Hello 
#{hello.value}");
  |      }
  |     
  |      
  |     
  |     
  |     @Destroy @Remove                                                        
              
  |     public void destroy() {}
  |     
  |     
  |     
  | }
  | 


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061699#4061699

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061699
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to