Package org.beangle.struts2.action

Examples of org.beangle.struts2.action.ActionTextResource


  protected void addFlashErrorNow(String msgKey, Object... args) {
    getFlash().addErrorNow(getTextInternal(msgKey, args));
  }

  protected Flash getFlash() {
    Flash flash = (Flash) ActionContext.getContext().getSession().get("flash");
    if (null == flash) {
      flash = new Flash();
      ActionContext.getContext().getSession().put("flash", flash);
    }
    return flash;
  }
View Full Code Here


  /**
   * 将flash中的消息转移到actionmessage<br>
   * 不要将flash和message混合使用。
   */
  public Collection<String> getActionMessages() {
    Flash flash = getFlash();
    @SuppressWarnings("unchecked")
    List<String> messages = (List<String>) flash.get(Flash.MESSAGES);
    if (null != messages) {
      for (String msg : messages) {
        addActionMessage(msg);
      }
      messages.clear();
View Full Code Here

  /**
   * 将flash中的错误转移到actionerror<br>
   * 不要将flash和error混合使用。
   */
  public Collection<String> getActionErrors() {
    Flash flash = getFlash();
    @SuppressWarnings("unchecked")
    List<String> errors = (List<String>) flash.get(Flash.ERRORS);
    if (null != errors) {
      for (String msg : errors) {
        addActionError(msg);
      }
      errors.clear();
View Full Code Here

      ObjectFactory objectFactory) {
    this.configuration = configuration;
    this.objectFactory = objectFactory;
    this.defaultParentPackage = "beangle";
    if (objectFactory instanceof SpringObjectFactory) {
      beanNameFinder = new SpringBeanNameFinder();
      SpringObjectFactory sf = (SpringObjectFactory) objectFactory;
      sf.autoWireBean(beanNameFinder);
    }
  }
View Full Code Here

      ObjectFactory objectFactory) {
    this.configuration = configuration;
    this.objectFactory = objectFactory;
    this.defaultParentPackage = "beangle";
    if (objectFactory instanceof SpringObjectFactory) {
      beanNameFinder = new SpringBeanNameFinder();
      SpringObjectFactory sf = (SpringObjectFactory) objectFactory;
      sf.autoWireBean(beanNameFinder);
    }
  }
View Full Code Here

      ObjectFactory objectFactory) {
    this.configuration = configuration;
    this.objectFactory = objectFactory;
    this.defaultParentPackage = "beangle";
    if (objectFactory instanceof SpringObjectFactory) {
      beanNameFinder = new SpringBeanNameFinder();
      SpringObjectFactory sf = (SpringObjectFactory) objectFactory;
      sf.autoWireBean(beanNameFinder);
    }
  }
View Full Code Here

        updated.add(newCategory);
      }
    }
    if (duplicatedNames.size() > 0) {
      addFlashErrorNow("dictionary.error.duplicateCategoryName", StrUtils.join(duplicatedNames,","));
      return forward(new Action(this, "categories"));
    } else {
      entityDao.save(updated);
      return redirect("categories", "info.save.success");
    }
  }
View Full Code Here

    if (!error) {
      addFlashMessage("info.save.success");
      entityDao.saveOrUpdate(meta);
      return redirect("index");
    } else {
      return forward(new Action(this, "edit"));
    }
  }
View Full Code Here

   */
  protected String saveAndForward(Entity<?> entity) {
    User user = (User) entity;
    if (entityDao.duplicate(User.class, user.getId(), "name", user.getName())) {
      addFlashMessageNow("security.error.usernameNotAvaliable", user.getName());
      return forward(new Action(this, "edit"));
    }
    String errorMsg = "";
    // // 收集用户身份
    String[] categories = StringUtils.split(get("categoryIds"), ",");
    user.getCategories().clear();
    for (int i = 0; i < categories.length; i++) {
      errorMsg = checkCategory(user, Long.valueOf(categories[i]));
      if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
    }
    // 检验用户合法性
    errorMsg = checkUser(user);
    if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
    processPassword(user);
    if (!user.isPersisted()) {
      User creator = userService.get(getUserId());
      userService.createUser(creator, user);
    } else {
View Full Code Here

    String name = get("name");
    if (StringUtils.isNotBlank(name)) {
      User user = userService.get(name);
      if (null != user) {
        put("user", user);
        return forward(new Action((Class<?>) null, "dashboard", "&user.id=" + user.getId()));
      } else {
        return null;
      }
    } else {
      return super.info();
View Full Code Here

TOP

Related Classes of org.beangle.struts2.action.ActionTextResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.