I'm currently learning about jsf 2.0 from core jsf 2.0 book + glassfish + cdi.
I would like to ask a question about handling validations that are not defined in the jsf pages or managed/named beans with bean-validation-framework.
I got these tiers in my head :
- 1) ui tier / jsf pages
- 1.5) jsf managed / named beans (i use 1.5, because i think it's still tightly coupled with the jsf tier, like the backing beans)
- 2) business logic tier (which are clean from jsf stuffs / imports, doing only pure business logic stuffs)
- 3) persistence tier
I imagine tier 1.5(jsf bean) initializing and calling tier 2(business logic objects), supplying arguments when calling business methods, fetching result, populating the result into jsf bean properties, so that the ui could render correctly.
What im curious is the fact that the tier 2(business logic objects) could do validations on the supplied arguments, or validating data, etc, and could throw exceptions or error objects.
I think i could handle the exceptions and get the error objects in the tier 1.5(jsf managed beans), but how am i supposed to display the error in the rendered pages ? I cant seem to find it from the book im reading, but i'm hoping there's a way to create a global error message and somehow could inject it into somewhere so that it gets rendered by the tag ?
Thank you !
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…