Beispiel #1
0
  protected void handleError(Controller controller) {

    controller.setAttr("status", "error");
    String actionKey = getActionKey();
    System.out.println("actionKey: " + actionKey);
    controller.renderJson();
  }
Beispiel #2
0
 @Override
 public void intercept(ActionInvocation ai) {
   Controller controller = ai.getController();
   try {
     User user = (User) controller.getSession().getAttribute("loginUser");
     if (user == null) {
       controller.renderJson(JsonHelp.buildFailed());
     }
     controller.renderJson(JsonHelp.buildSuccess(JsonKit.toJson(user)));
     System.out.println(user.getStr("email"));
   } catch (Exception e) {
     e.printStackTrace();
     controller.renderJson(JsonHelp.buildFailed());
   }
   ai.invoke();
 }
 @Override
 protected void handleError(Controller c) {
   c.keepModel(User.class);
   c.keepPara();
   c.setAttr("state", "failure");
   if (ReturnKit.isJson(c.getRequest())) c.renderJson();
   else {
     if (getActionKey().equals("/member/control")) c.forwardAction("/member");
   }
 }
  @Override
  public void intercept(ActionInvocation ai) {
    Controller controller = ai.getController();
    int id = controller.getParaToInt("id", 0);
    if (id == 0) {
      controller.renderJson("msg", "id is blank");
      return;
    }

    User targetUser = UserService.getById(id);
    if (targetUser == null) {
      controller.renderJson("msg", "no such user");
      return;
    }

    controller.setAttr("targetUser", targetUser);

    ai.invoke();
  }
Beispiel #5
0
 @Override
 protected void handleError(Controller c) {
   c.renderJson(ERROR_MSG, c.getAttr(ERROR_MSG));
 }