Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling while making Ajax calls

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry I thought IMO means that is a library.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic