users@woodstock.java.net

Re: Ajax Errors

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Tue, 08 Apr 2008 19:21:39 -0400

Jason Suplizio wrote:
> Thanks, but to clarify, when I say capture, I didn't mean view them in
> Firebug, I mean that I need to deal with them in my javascript. Here's
> a scenario to help clarify:
>
> I have a user entering text into a textField component and when they
> click on the submit button i call textField.submit() - which fires off
> and asynchronous request. However, there is a failure either sending
> or receiving the response...therefore I need to show an alert to tell
> the user that there is a communication problem with the server.

This may not be quite what you're looking for, but you can subscribe to
the submit event. If JSF generated any errors (e.g., validation
exceptions), the messages should be available in the object literals
published when the event is complete. Although, this won't tell you if
the actual request/response failed. Obviously, if there is no response,
there is no event to publish.

    // Subscribe to submit event.
    var domNode = document.getElementById("form1:textField2");
    domNode.subscribe(domNode.event.submit.endTopic, processEvents, "update");


>
> So, how can I capture an async request/response failure? Isn't 4.1.1
> built on prototype? Would it be possible get prototype's
> Ajax.Base.responseIsFailure property for a specific component?

Woodstock 4.1.1 uses a couple Prototype functions, but DynamicFaces is
really what you're looking for here. (DynamicFaces is built on
Prototype.) I don't know if JSF Extensions exposed this or not, but you
can try your question on the users_at_jsf-extensions.dev.java.net alias.

Dan

>
> Any advice would be appreciated?
> Jas
>
>
> On Tue, Apr 8, 2008 at 1:47 PM, Felipe Jaekel <fkjaekel_at_gmail.com
> <mailto:fkjaekel_at_gmail.com>> wrote:
>
> Try Firefox's Firebug extension
>
> 2008/4/8, Jason Suplizio <suplizio_at_gmail.com
> <mailto:suplizio_at_gmail.com>>:
>
> I need a capture when a component's asynchronous request is
> failing. For example, if I call component. refresh() or
> component.submit() and the communication/request to the server
> is failing, how do I detect this?
>
> Please help, I need to find a solution asap.
>
> Jason
>
>
>