Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to trigger onerror of f:ajax inside a h:commandButton?

801328Oct 7 2010 — edited Feb 15 2012
hi, how to trigger onerror of f:ajax inside a h:commandButton from it's action method?
<h:form>
   <h:inputText id="i1" value="#{bean.i1}"/>
   <h:commandButton id="go" action="#{bean.process}" value="go">
      <f:ajax render="o1" onerror="myfunction();"/>
   </h:commandButton>
   <h:outputText id="o1" value="#{bean.o1}"/>
</h:form>
then in the bean
    public String process() {
        if(isOK()) {
            calculate();
            return null;
        } else {
            //here I want to send an ajax error, to trigger the onerror function in the client
        }
   }
I don't know what I must do inside the action method to signalize an ajax error. Do I have to throw a specific Exception or any run time exception, or another approach?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2012
Added on Oct 7 2010
3 comments
1,363 views