Package org.apache.struts.action

Examples of org.apache.struts.action.ActionErrors


      // 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)
     
      NoteList DL = null ;
View Full Code Here


    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user
    int entityID = userObject.getEntityId();    // entityID of the logged-in user's entity
   
    ActionErrors allErrors = new ActionErrors();

    // "customerFaqForm", defined in cv-struts-config.xml
    DynaActionForm faqForm = (DynaActionForm)form;

    try {
      // get the event ID from the form bean
      Integer formFaqID = (Integer)faqForm.get("faqID");
      // create an int to hold the faq ID value
      int faqID = 0;

      // now, check the faq ID on the form...
      if (formFaqID == null) {
        // if faq ID is not set on the form, then there is
        // no point in continuing forward. Show the user an
        // error and quit.
        allErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "FAQ ID"));
        return(mapping.findForward(forward));
      }else{
        // if faq ID is set on the form properly, then set
        // the int representation for use in the code below
        faqID = formFaqID.intValue();
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

    // 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)
       
    try
View Full Code Here

    int entityID = userObject.getIndividualID();    // logged in user's entityID

    // "customerKBListForm" defined in cv-struts-config.xml
    DynaActionForm kbForm = (DynaActionForm)form;

    ActionErrors allErrors = new ActionErrors();

    try
    {
      Integer formCategoryID = (Integer)kbForm.get("categoryID");
      int categoryID = 0;

      if (formCategoryID == null)
      {
        categoryID = 1;
      }else{
        categoryID = formCategoryID.intValue();
      }

      ListPreference listPrefs = userObject.getListPreference("Knowledgebase");

      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      int records = listPrefs.getRecordsPerPage();
      String sortElement = listPrefs.getSortElement();
      boolean customerViewFlag = true;
      KnowledgebaseList kbList = (KnowledgebaseList)lg.getKnowledgebaseList(individualID, 1, records, "", sortElement, categoryID,customerViewFlag);

      Set listkey = kbList.keySet();
      Iterator iter = listkey.iterator();
      while (iter.hasNext())
      {
        String key = (String)iter.next();
        ListElement row = (ListElement)kbList.get(key);

        int elementID = row.getElementID();

        StringMember categoryField = (StringMember)row.get("CatKB");
        String type = categoryField.getDisplayString();

        StringMember nameField = (StringMember)row.get("Name");

        if (type.equals(SupportConstantKeys.CATEGORY))
        {
          // if the list element is a category, then we need to link to KBList.do
          nameField.setRequestURL("KBList.do?categoryID=" + elementID);
          categoryField.setRequestURL("KBList.do?categoryID=" + elementID);
        }else if (type.equals(SupportConstantKeys.KBELEMENT)){
          // if the list element is a KB entry, then we need to link to ViewKB.do
          nameField.setRequestURL("ViewKB.do?kbID=" + elementID);
          categoryField.setRequestURL("ViewKB.do?kbID=" + elementID);
        }
      }   // end while(iter.hasNext())

      kbList.setCurrentCategoryID(categoryID);
      session.setAttribute("displaylist", kbList);
      request.setAttribute("displaylist", kbList);
    }catch(Exception e){
      System.out.println("[Exception][CV KBListHandler] Exception thrown in execute(): " + e);
      allErrors.add("error.unknownError", new ActionMessage("error.unknownError"));
    }

    if (! allErrors.isEmpty())
    {
      saveErrors(request, allErrors);
    }
    return(mapping.findForward(forward));
  }   // end execute() method
View Full Code Here

    UserObject userObject = (UserObject)session.getAttribute("userobject");

    int individualID = userObject.getIndividualID();    // logged in user
    int entityID = userObject.getEntityId();    // entityID of the logged-in user's entity

    ActionErrors allErrors = new ActionErrors();

    // "customerProfileForm", defined in cv-struts-config.xml
    DynaActionForm profileForm = (DynaActionForm)form;
   
    EmailSettingsHome emailSettingsHome = (EmailSettingsHome)CVUtility.getHomeObject("com.centraview.administration.emailsettings.EmailSettingsHome","EmailSettings");
   
    try {
      EmailSettings emailSettingsRemote = (EmailSettings)emailSettingsHome.create();
      emailSettingsRemote.setDataSource(dataSource);
     
      // Its a predefined Template for the replying message for the Change Of Profile Information
      EmailTemplateForm custProfileTemplateForm = emailSettingsRemote.getEmailTemplate(AdministrationConstantKeys.EMAIL_TEMPLATE_CUST_PROFILE);
      String toAddress = custProfileTemplateForm.getToAddress();
      String fromAddress = custProfileTemplateForm.getFromAddress();
      String replyTo = custProfileTemplateForm.getReplyTo();
      String emailSubject = custProfileTemplateForm.getSubject();
      String emailBody = custProfileTemplateForm.getBody();
     
      MailMessageVO mailMessage = new MailMessageVO();
      ArrayList toList = new ArrayList();
      toList.add(toAddress);
      mailMessage.setToList(toList);
      mailMessage.setHeaders("Change Of Profile Information");
      mailMessage.setContentType("text/plain");
      mailMessage.setFromAddress(fromAddress);
      mailMessage.setReplyTo(replyTo);
      mailMessage.setSubject(emailSubject);
     
      StringBuffer body = new StringBuffer("");
      body.append(emailBody);
      body.append("\n\nCustomer Profile Change Request:\n\n");
     
      DynaActionForm dynaForm = (DynaActionForm)form;
     
      String entityName = (String)dynaForm.get("entityName");
      body.append("Entity Name: " + entityName + "\n");
     
      String website = (String)dynaForm.get("website");
      body.append("Website: " + website + "\n");
     
      String street1 = (String)dynaForm.get("street1");
      body.append("Street1: " + street1 + "\n");
     
      String street2 = (String)dynaForm.get("street2");
      body.append("Street2: " + street2 + "\n");
     
      String city = (String)dynaForm.get("city");
      body.append("City: " + city + "\n");
     
      String state = (String)dynaForm.get("state");
      body.append("State: " + state + "\n");
     
      String zipCode = (String)dynaForm.get("zipCode");
      body.append("Zip Code: " + zipCode + "\n");
     
      String country = (String)dynaForm.get("country");
      body.append("Country: " + country + "\n");
     
      String mocContent = "";
      String mocTypeName = "";
      if (dynaForm.get("email") != null) {
        mocContent = (dynaForm.get("email") == null) ? "" : (String)dynaForm.get("email");
        body.append("Email: " + mocContent + "\n");
      }
     
      for (int i = 1; i < 4; i++) {
        mocContent = CVUtility.getMOCContent(dynaForm, i + "");
        int mocType = Integer.parseInt((String)dynaForm.get("mocType" + i));
        mocTypeName = CVUtility.getSyncAs(mocType);
        body.append(mocTypeName + ": " + mocContent + "\n");
      }
     
      body.append("\n\nEnd CentraView Web Request\n");
     
      mailMessage.setBody(body.toString());
     
      boolean messageSent = emailSettingsRemote.simpleMessage(individualID,mailMessage);
     
      if (! messageSent) {
        // if email message is not sent, let the user know we suck
        allErrors.add("error.customer.profile.emailSendFailure", new ActionMessage("error.customer.profile.emailSendFailure"));
      }
    }catch(Exception e){
      // if an exception occurs, then print a message to the log file,
      // direct the user to the Customer Profile form, and show them
      // an error.
      logger.error("[Exception] UpdateProfileHandler.Execute Handler ", e);
      allErrors.add("error.unknownError", new ActionMessage("error.unknownError"));
      forward = ".view.customer.profile";
    }

    if (! allErrors.isEmpty()) {
      // no point in saving errors to the request if there aren't any
      saveErrors(request, allErrors);
    }
    return(mapping.findForward(forward));
  }   // end execute() method
View Full Code Here

   *          HttpServletRequest
   * @return ActionErrors
   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    // initialize new actionerror object
    ActionErrors errors = new ActionErrors();
    try {
      // file name
      FormFile file = this.getFile();

      String fileName = "";

      HttpSession session = request.getSession(true);
      String fEmployee = (String) session.getAttribute("FromEmployee");

      if (request.getParameter(FileConstantKeys.TYPEOFOPERATION).equals(FileConstantKeys.EDIT)) {
        fileName = this.getFileInfo();
        if (fileName == null || fileName.trim().length() == 0) {
          errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "File Name"));
        }
      } else if (file != null) {
        fileName = file.getFileName();
        if (fileName == null || fileName.trim().length() == 0) {
          errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "File Name"));
        }
      } else {
        if (fEmployee != null && !fEmployee.equals("EmployeeHandbook")) {
          if (fileName == null || fileName.trim().length() == 0) {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "File Name"));
          }
        }
      }

      if (fEmployee != null && !fEmployee.equals("EmployeeHandbook")) {
        if (this.getUploadfoldername() == null || this.getUploadfoldername().trim().length() == 0) {
          errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Folder Name"));
        }
      }

      // title
      if (this.getTitle() == null || this.getTitle().trim().length() == 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Title"));
      }

      // description
      if (this.getDescription() == null || this.getDescription().trim().length() == 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Description"));
      }

      // redirect to jsp if errors present
      if (!errors.isEmpty()) {
        request.setAttribute("bodycontent", "editdetailfile");
      }

      if (request.getParameter(FileConstantKeys.TYPEOFOPERATION) != null
          && request.getParameter(FileConstantKeys.TYPEOFOPERATION).equals("EDIT")) {
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 = ".view.email.editfolder";
   
    // "mailFolderForm", defined in struts-config-email.xml
    DynaActionForm folderForm = (DynaActionForm)form;

    try
    {
      // get the folder ID from the form bean
      Integer folderID = (Integer)folderForm.get("folderID");
     
      // now, check the folder ID on the form...
      if (folderID == null || folderID.intValue() <= 0 )
      {
        // if folder 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", "Folder ID"));
        return(mapping.findForward(forward));
      }
     
      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = (Mail)home.create();
View Full Code Here

   */
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
  {

    // initialize new actionerror object
    ActionErrors errors = new ActionErrors();

    try {
      String tempTitle = this.getTitle();
      if (tempTitle == null || tempTitle.trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Title"));
      }

      if (errors != null) {
        request.setAttribute("noteform", this);
      }
View Full Code Here

    } catch(Exception e) {
      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);
    }
    return new ActionForward(request.getParameter("currentPage"), true);
 
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.