I am using spring 3 MVC and i have below classes.
External system would call my application using below URL:
http://somehost/root/param1/param2/param
JSONObject jsonobject=new JSONObject(); jsonobject.put("error","Invalid username"); response.getWriter().write(jsonobject.toString());
in javascript:
f(data!=success){ var errorMessage=jQuery.parseJson(data); alert(errorMessage.error); }