Examples of ActionMessage


Examples of org.apache.struts.action.ActionMessage

  {
    LinkForm lform = (LinkForm)form;
    super.validateClientId(request, lform);
    ActionMessages msgs = new ActionMessages();
    if(StringUtils.isEmpty(lform.getTitle())){
      msgs.add("title", new ActionMessage("error.link_title_empty"));
    }
    else if(StringUtils.isEmpty(lform.getUrl())){
      msgs.add("url", new ActionMessage("error.link_url_empty"));
    }
    else{
      LinkBean lbean = new LinkBean();
      lbean.setCreateTime(new Date());
      lbean.setSiteId(lform.getSid());
      lbean.setTitle(lform.getTitle());
      lbean.setUrl(lform.getUrl());
      lbean.setType(lform.getType());
      lbean.setStatus(lform.getStatus());
      try{
        LinkDAO.create(lbean, lform.getId(), (lform.getDirection()==1));
      }catch(Exception e){
        msgs.add("link", new ActionMessage("error.database", e.getMessage()));
      }
    }
   
    if(!msgs.isEmpty())
      return mapping.getInputForward();
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

      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

Examples of org.apache.struts.action.ActionMessage

   */
  public ActionErrors checkForRequired(String fieldLabel, String fieldValue, String errorKey,
      ActionErrors actionErrors)
  {
    if (fieldValue == null || fieldValue.trim().length() == 0) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

   */
  public ActionErrors checkForArrayRequired(String fieldLabel, String[] fieldValue,
      String errorKey, ActionErrors actionErrors)
  {
    if (fieldValue == null || fieldValue.length == 0) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

   */
  public ActionErrors checkForMaxlength(String fieldLabel, String fieldValue, String errorKey,
      ActionErrors actionErrors, int maxLength)
  {
    if (fieldValue != null && fieldValue.trim().length() > maxLength) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel), ""
          + maxLength);
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

      ActionErrors actionErrors)
  {
    try {
      Integer.valueOf(fieldValue);
    } catch (Exception e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

      ActionErrors actionErrors)
  {
    try {
      Float.valueOf(fieldValue);
    } catch (Exception e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    Calendar calendar = Calendar.getInstance();
    calendar.setLenient(false);
    try {
      calendar.set(Integer.parseInt(yearValue), Integer.parseInt(monthValue), Integer.parseInt(dayValue));
    } catch (Exception e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    try {
      Date parsedDate = df.parse(date);
      calendar.setTime(parsedDate);
    } catch (ParseException e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    } catch (Exception e) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionMessage

      isError = false;
    } catch (Exception e) {
      isError = true;
    }
    if (isError) {
      ActionMessage error = new ActionMessage(errorKey, messages.getMessage(fieldLabel));
      actionErrors.add(errorKey, error);
    }
    return actionErrors;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.