Package org.apache.struts.action

Examples of org.apache.struts.action.ActionErrors


    HttpSession session = request.getSession();
    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user
   
    ActionErrors allErrors = new ActionErrors();
    String forward = ".forward.preference.mail.account_list";

    // "mailAccountForm" defined in struts-config-preference.xml
    DynaActionForm accountForm = (DynaActionForm)form;
   
    try {
      // get the account ID from the form bean
      Integer accountID = (Integer)accountForm.get("accountID");
     
      // now, check the account ID on the form...
      if (accountID == null || accountID.intValue() <= 0) {
        // if account ID is not set on the form, then there is
        // no point in continuing forward. Show user the door. :-)
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Account ID"));
        return(mapping.findForward(forward));
      }

      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = (Mail)home.create();
View Full Code Here


    HttpSession session = request.getSession();
    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user

    ActionErrors allErrors = new ActionErrors();
    String forward = "showContactDetails";

    // "webformContactForm" defined in struts-config-email.xml
    DynaActionForm emailForm = (DynaActionForm)form;
View Full Code Here

  // After performing the logic in the DeleteHanlder, we are generat a new request for the list
  // So we will not be carrying the old error. So that we will try to collect the error from the Session variable
  // Then destory it after getting the Session value
  if (session.getAttribute("listErrorMessage") != null)
  {
    ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
    saveErrors(request, allErrors);
    session.removeAttribute("listErrorMessage");
  }//end of if (session.getAttribute("listErrorMessage") != null)

    if (rowId != null)
View Full Code Here

      // After performing the logic in the DeleteHanlder, we are generat a new request for the list
      // So we will not be carrying the old error. So that we will try to collect the error from the Session variable
      // Then destory it after getting the Session value
      if (session.getAttribute("listErrorMessage") != null)
      {
        ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
        saveErrors(request, allErrors);
        session.removeAttribute("listErrorMessage");
      }//end of if (session.getAttribute("listErrorMessage") != null)
     
      if (session.getAttribute("highlightmodule") != null)
View Full Code Here

        // After performing the logic in the DeleteHanlder, we are generat a new request for the list
        // So we will not be carrying the old error. So that we will try to collect the error from the Session variable
        // Then destory it after getting the Session value
        if (session.getAttribute("listErrorMessage") != null)
        {
          ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
          saveErrors(request, allErrors);
          session.removeAttribute("listErrorMessage");
        }//end of if (session.getAttribute("listErrorMessage") != null)
       
      if (orderidStr != null && !orderidStr.equals(""))
View Full Code Here

  }

  /* For Form Validation */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
  {
    ActionErrors errors = new ActionErrors();

    // cache the form data
    convertItemLines();

    try {
      Validation validation = new Validation();
      validation.checkForMaxlength("label.account.expense.description", this
          .getExpenseDescription(), "error.application.maxlength", errors, 40);
      validation.checkForRequired("label.account.expense.entity", this.getEntity(),
          "error.application.required", errors);
      validation.checkForRequired("label.account.expense.employee", this.getEmployee(),
          "error.application.required", errors);
      // validation.checkForRequired("label.account.expense.project",this.getProject(),"error.application.required","",errors);

      boolean itemPresent = false;
      int counter = 0;

      if (this.itemid != null) {
        for (int i = 0; i < this.linestatus.length; i++) {
          if (this.linestatus[i] != null && this.linestatus[i].equalsIgnoreCase("Deleted")) {
            counter++;
          }
        }

        if (this.linestatus.length > 0 && this.linestatus.length != counter) {
          itemPresent = true;
        }
      }

      if (itemPresent == false) {
        ActionMessage error = new ActionMessage("error.application.required", messages
            .getMessage("error.account.expense.itemsrequired"));
        errors.add("error.application.required", error);
      }

      if (errors != null && errors.size() > 0) {

        request.setAttribute("TYPEOFSUBMODULE", "ORDER");
        request.setAttribute("body", "EDIT");
        request.setAttribute("expenseform", this);
      }
View Full Code Here

      logger.error("[execute] Exception thrown.", e);
      throw new CommunicationException(e.getMessage());
    }
    if (!deleteLog.isEmpty())
    {
      ActionErrors allErrors = new ActionErrors();
      allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm", "You do not have permission to delete one or more of the records you selected."));
      session.setAttribute("listErrorMessage", allErrors);
    }
    ActionForward forward = new ActionForward(request.getParameter("currentPage"), true);
    return forward;
  }
View Full Code Here

  private static final String FORWARD_save = ".view.preference.user_profile";

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    ActionErrors allErrors = new ActionErrors();
    ActionForward forward = null;
    try
    {
      DynaActionForm dynaForm = (DynaActionForm)form;

      HttpSession session = request.getSession();
      int individualId = ((UserObject)session.getAttribute("userobject")).getIndividualID();

      String typeOfSave = "saveclose";

      if (request.getParameter("buttonpress") != null)
      {
        typeOfSave = request.getParameter("buttonpress");
      }

      UserHome uhome = (UserHome)CVUtility.getHomeObject("com.centraview.administration.user.UserHome", "User");
      User uRemote = (User)uhome.create();
      uRemote.setDataSource(dataSource);
      String oldPassword = "", newPassword = "";
      // TODO integrate password change with RememberMe functionallity.
      if (uRemote != null)
      {
        oldPassword = (String)request.getParameter("oldpassword");
        newPassword = (String)request.getParameter("newpassword");
      }

      if (newPassword != null && newPassword.length() != 0)
      {
        try
        {
          uRemote.changePassword(individualId, oldPassword, newPassword);
        } catch (UserException ue) {
          if (ue.getExceptionId() == UserException.COULDNOT_CHANGE_PASSWORD)
          {
            allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.freeForm",
                "Error while updating login information, " + ue.getExceptionDescription()));
            saveErrors(request, allErrors);
          } else {
            ue.printStackTrace();
          }
View Full Code Here

    HttpSession session = request.getSession(true);
    UserObject userObject = (UserObject)session.getAttribute("userobject");
    int individualId = userObject.getIndividualID();
   
    //  Check the session for an existing error message (possibly from the delete handler)
    ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
    if (allErrors != null) {
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }
   
View Full Code Here

    HttpSession session = request.getSession(true);

    // Check the session for an existing error message (possibly from the delete
    // handler)
    ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
    if (allErrors != null) {
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionErrors

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.