java - JSF2.0 - Handling erroneous Ajax calls with Primefaces 3.0 -
java - JSF2.0 - Handling erroneous Ajax calls with Primefaces 3.0 -
i have commandbutton
in .xhtml page:
<p:commandbutton action="#{someone.dosomething()}" ajax="true" onerror="errordialog.show();"> </p:commandbutton>
it's making ajax call. how can observe situations such net connection problem (of client/browser), timeout, session-timeout, server-side exceptions, crashes etc in middle of ajax phone call show informative message user?
does onerror
attribute of p:ajax
handle of those? if not, what? :) what's default timeout btw?
any help appreciated, thanks.
onerror calls function: onerror(xhr, status, exception) - javascript callback process when ajax request fails. takes 3 arguments, xmlhttprequest, status string , exception thrown if any. this info documentation. xhr - request. there can found request status , lot of other info.
<p:commandbutton action="#{someone.dosomething()}" ajax="true" onerror="console.debug(xhr)"> </p:commandbutton>
try code in chrome or firebug. show xhr object
get http://primefaces.googlecode.com/files/primefaces_users_guide_3_0.pdf section 7.2 ajax api
java ajax jsf java-ee primefaces
Comments
Post a Comment