-
1. Re: Very basic validation question
hstang Jul 8, 2007 12:06 AM (in response to michaelcourcy)did you try using s:message ?
-
2. Re: Very basic validation question
michaelcourcy Jul 8, 2007 4:06 AM (in response to michaelcourcy)"hstang" wrote:
did you try using s:message ?
Yes I did that first, but it seams that <s:message/> is to be used inside a <s:decorate> </s:decorate> tag. -
3. Re: Very basic validation question
gavin.king Jul 8, 2007 6:33 AM (in response to michaelcourcy)
So what did I miss ?
Not sure, looks good to me.... -
4. Re: Very basic validation question
michaelcourcy Jul 8, 2007 9:18 AM (in response to michaelcourcy)"gavin.king@jboss.com" 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() {} }
-
5. Re: Very basic validation question
snowracer Jul 24, 2007 7:29 PM (in response to michaelcourcy)I have the same problem. Validation works in Entity bean but not in Stateful bean. I'm just beginnig with Seam and it confused me for a few hours. Is it a bug or a feature?
btw: I'm getting to like Seam more and more anyway. Great work! -
6. Re: Very basic validation question
paradigmza Jul 25, 2007 2:38 AM (in response to michaelcourcy)I also have this problem, which I posted about yesterday
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114280 -
7. Re: Very basic validation question
paradigmza Jul 25, 2007 2:49 AM (in response to michaelcourcy)I just tested the Entity vs. Stateful and the same is happening for me... entity works, stateful does not.
-
8. Re: Very basic validation question
snowracer Jul 26, 2007 4:06 PM (in response to michaelcourcy)So would somebody post a bugreport for this? I'm quite new to Java EE, and I'm afraid that I can't express the problem good enough yet.
-
9. Re: Very basic validation question
michael.yuan Jul 26, 2007 4:10 PM (in response to michaelcourcy)The validation annotations are processed by Hibernate. They are *not* supposed to work on stateful session beans. To validate data in the session bean, you have to write your own validation code, or you can use JSF validator tags in the view page.
-
10. Re: Very basic validation question
matt.drees Jul 26, 2007 4:56 PM (in response to michaelcourcy)Hmm, are you sure?
http://jira.jboss.com/jira/browse/JBSEAM-1626 seems to indicate that they should work on session beans. -
11. Re: Very basic validation question
gavin.king Jul 26, 2007 5:09 PM (in response to michaelcourcy)"michael.yuan@jboss.com" wrote:
The validation annotations are processed by Hibernate. They are *not* supposed to work on stateful session beans. To validate data in the session bean, you have to write your own validation code, or you can use JSF validator tags in the view page.
That's not true, validation annotations are supposed to work on SFSBs, but there was a bug in Seam 2.0 beta 1 that meant they had to be declared on the local interface. This is already fixed in CVS. -
12. Re: Very basic validation question
snowracer Jul 26, 2007 5:16 PM (in response to michaelcourcy)"gavin.king@jboss.com" wrote:
That's not true, validation annotations are supposed to work on SFSBs, but there was a bug in Seam 2.0 beta 1 that meant they had to be declared on the local interface. This is already fixed in CVS.
Thanks for support. Seam is just great :-) -
13. Re: Very basic validation question
michael.yuan Jul 26, 2007 7:11 PM (in response to michaelcourcy)Oh, I did not know that! Thanks for the update.