Example #1
0
 public static void errorMessage(HttpServletResponse response, String message) {
   try {
     JSONObject json = new JSONObject();
     json.put("success", false);
     json.put("message", message);
     JSON.showJson(response, json);
   } catch (JSONException ex) {
     Logger.getLogger(JSON.class.getName()).log(Level.SEVERE, null, ex);
   } catch (IOException ex) {
     Logger.getLogger(JSON.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
Example #2
0
 public static void successRedirect(HttpServletResponse response, String redirectTo) {
   try {
     JSONObject json = new JSONObject();
     json.put("success", true);
     json.put("url", redirectTo);
     JSON.showJson(response, json);
   } catch (JSONException ex) {
     Logger.getLogger(JSON.class.getName()).log(Level.SEVERE, null, ex);
   } catch (IOException ex) {
     Logger.getLogger(JSON.class.getName()).log(Level.SEVERE, null, ex);
   }
 }