[jboss-user] [JBoss Seam] - Re: Handling context-based validation
ellenzhao
do-not-reply at jboss.com
Wed Aug 15 07:26:26 EDT 2007
You may want to try to make your validator object be aware of the current context/conversation/use case (pick a word which is appropriate for your situation). My own project does not have any validator object yet (all the constraint logic is either in entity beans or in the entity manager beans), but I imagine it is possible to put a field
| AppContext currentContext;
|
or
AppConversation currentConversation;
or
AppUseCase currentUseCase;
in your validator. And also setter and getter for this field. Your other objects like Person object can call the setter to let the validator know the current context/conversation/use case before calling the validation method. So that the current current context/conversation/usecase information is available in your validator object. Conceptually it should work.
You can put the names of all the app-specific context/conversation/use case in a enum to eliminate String typing errors in your java class. An example can be seen here:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=115871
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074382#4074382
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074382
More information about the jboss-user
mailing list