model view controller - How does business logic class calls methods inside a managed bean? -
i have business logic code renders facesmessages on facelet based on output, made method in facelet managed bean method:
public void renderfacesmessages(string summary, string detail) { facesmessage message = new facesmessage(summary, detail); facescontext.getcurrentinstance().addmessage(null, message); }
and business logic class pass arguments method according message that's needed, question right approach business logic call method on managed bean?
it layering concept...
i presume have managedbean has method delegate business logic seperate business class/module. if case,i tell ,never have faces methods on business side...
instead have business results wrapped in class , return managed bean.this result class encompass results,meta information result like,errors,exceptions.so managed bean can use renderfacesmessage method
even if had not followed above presumption:my suggestion never have jsf faces logic inside business components.it bad idea.
Comments
Post a Comment