Hi, We are using struts2 JSONValidationWithInterceptor. This interceptor grabs the errors from validation and convert them to json message How can we have same feature! An interceptor which grabs the action exceptions and serialize them as json errors.
I try below interceptor. When an exception happens it works, when there are no errors and I should pass {} to response it is not working! _______________________________________________ String target=Action.NONE; try { target=invocation.invoke(); response.getWriter().print("{}"); response.setContentType("application/json"); return target; } catch (BussinessException ex) { StringBuilder sb = new StringBuilder(); sb.append("{ "); sb.append("\"errors\": [\""); sb.append("Bussiness Exception Happend"); sb.append("\"]}"); response.setContentType("application/json"); response.getWriter().print(sb.toString()); return Action.NONE; } ~Regards, ~~Alireza Fattahi