aspose file tools*
The moose likes JSF and the fly likes Exception Handling while making Ajax calls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Exception Handling while making Ajax calls" Watch "Exception Handling while making Ajax calls" New topic
Author

Exception Handling while making Ajax calls

jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

I am developing an application using JSF2, Primefaces and Hibernate. I have lot of Ajax calls. Can any one advice me how to handle the situation when there is any run time exception like null pointer exceptions, array index out of bound exceptions...?

And also I have a problem to make generic exception handling. Can any body give example for this?

Thanks for your help in advance.
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
Probably have to trap these exceptions in your servlet's and send a response back that tells the ajax call it's an exception. I imagine you could be as generic or a specific as you'd like with your exception-response.

Otherwise, ajax calls don't have a way to differentiate between successful responses and erroneous responses.

IMO jQuery has a good ajax api. Works well for this scenario.
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi Philip,

Thanks for your response. What is that IMO jQuery? I googled for it I couldn't find any information about IMO jQuery.

Thanks,
Philip Thamaravelil
Ranch Hand

Joined: Feb 09, 2006
Posts: 99
no problem. I was saying in my opinion (IMO) jQuery is a good javascript library.

It abstracts all the javascript required to make ajax calls..No messing with the xmlhttp object..just pure jquery..

http://jquery.org/ is the website, they have lot's of examples.


Also, I've had great experience with jQuery mobile for your mobile applications.



jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
I am sorry I thought IMO means that is a library.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception Handling while making Ajax calls