java - Seam centralized exceptions -
i'm using seam 2.2, primefaces view presentation layer. write kind of infrastructure in order capture exceptions. example put in facelets following piece of code:
<p:commandbutton actionlistener="#{myseamcontroller.amethod()}"
in myseamcontroller class, above method:
public void amethod() { throw new nullpointerexception(); }
in controller write method:
@observer("myapp.exceptions.exception") public void onsystemexception(exception e) { system.out.println("a exception occurred"); }
i write class catch exceptions:
@scope(scopetype.application) @bypassinterceptors @install( precedence = install.mock, classdependencies = "javax.faces.context.facescontext") @name("org.jboss.seam.exception.exceptions") public class exceptionhandler extends org.jboss.seam.exception.exceptions{ private static final long serialversionuid = 1l; @logger log log; public void handle(exception e) throws exception { events.instance().raiseevent("myapp.exceptions.exception", e); super.handle(e); } }
but i've noticed taht when use actionlistener
<p:commandbutton actionlistener="#{myseamcontroller.amethod()}"
instead of action
<p:commandbutton action="#{myseamcontroller.amethod()}"
no exception observed exceptionhandler class. why? can help? best regards
create interceptor, , can catch need.
Comments
Post a Comment