Examples of ActionError


Examples of org.apache.struts.action.ActionError

                ObjectName oname =
                    new ObjectName(objectName);
                if (mBServer.isRegistered(oname)) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("realmName",
                               new ActionError("error.realmName.exists"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }

                // Look up our MBeanFactory MBean
View Full Code Here

Examples of org.apache.struts.action.ActionError

        // front end validation when save is clicked.
        if (submit != null) {
           
            // docBase cannot be null
            if ((docBase == null) || (docBase.length() < 1)) {
                errors.add("docBase", new ActionError("error.docBase.required"));
            }
           
            // if path is empty, it's root context
            // validate context starting with "/" only at the time of context creation.
            //if ("Create".equalsIgnoreCase(adminAction) && !path.startsWith("/")) {
View Full Code Here

Examples of org.apache.struts.action.ActionError

    private void numberCheck(String field, String numText, boolean rangeCheck,
    int min, int max) {
       
        // Check for 'is required'
        if ((numText == null) || (numText.length() < 1)) {
            errors.add(field, new ActionError("error."+field+".required"));
        } else {
           
            // check for 'must be a number' in the 'valid range'
            try {
                int num = Integer.parseInt(numText);
                // perform range check only if required
                if (rangeCheck) {
                    if ((num < min) || (num > max ))
                        errors.add( field,
                        new ActionError("error."+ field +".range"));
                }
            } catch (NumberFormatException e) {
                errors.add(field,
                new ActionError("error."+ field + ".format"));
            }
        }
    }
View Full Code Here

Examples of org.apache.struts.action.ActionError

        if (servlet.getDebug() >= 1) {
            servlet.log(" Checking transactional control token");
        }
        if (!isTokenValid(request))
            errors.add(ActionErrors.GLOBAL_ERROR,
                       new ActionError("error.transaction.token"));
        resetToken(request);

  // Validate the request parameters specified by the user
        if (servlet.getDebug() >= 1)
            servlet.log(" Performing extra validations");
  String value = null;
  value = regform.getUsername();
  if (("Create".equals(action)) &&
      (database.get(value) != null))
            errors.add("username",
                       new ActionError("error.username.unique",
                                       regform.getUsername()));
  if ("Create".equals(action)) {
      value = regform.getPassword();
      if ((value == null) || (value.length() <1))
                errors.add("password",
                           new ActionError("error.password.required"));
      value = regform.getPassword2();
      if ((value == null) || (value.length() < 1))
                errors.add("password2",
                           new ActionError("error.password2.required"));
  }

  // Report any errors we have discovered back to the original form
  if (!errors.empty()) {
      saveErrors(request, errors);
View Full Code Here

Examples of org.apache.struts.action.ActionError

                                 HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((username == null) || (username.length() < 1))
            errors.add("username",
                       new ActionError("error.username.required"));
        if (!password.equals(password2))
            errors.add("password2",
                       new ActionError("error.password.match"));
        if ((fromAddress == null) || (fromAddress.length() < 1))
            errors.add("fromAddress",
                       new ActionError("error.fromAddress.required"));
        else {
      int atSign = fromAddress.indexOf("@");
      if ((atSign < 1) || (atSign >= (fromAddress.length() - 1)))
    errors.add("fromAddress",
                           new ActionError("error.fromAddress.format",
                                           fromAddress));
  }
  if ((fullName == null) || (fullName.length() < 1))
            errors.add("fullName",
                       new ActionError("error.fullName.required"));
  if ((replyToAddress != null) && (replyToAddress.length() > 0)) {
      int atSign = replyToAddress.indexOf("@");
      if ((atSign < 1) || (atSign >= (replyToAddress.length() - 1)))
                errors.add("replyToAddress",
                           new ActionError("error.replyToAddress.format",
                                           replyToAddress));
  }

        return errors;
View Full Code Here

Examples of org.apache.struts.action.ActionError

  String password = ((LogonForm) form).getPassword();
  Hashtable database = (Hashtable)
    servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
  if (database == null)
            errors.add(ActionErrors.GLOBAL_ERROR,
                       new ActionError("error.database.missing"));
  else {
      user = (User) database.get(username);
      if ((user != null) && !user.getPassword().equals(password))
    user = null;
      if (user == null)
                errors.add(ActionErrors.GLOBAL_ERROR,
                           new ActionError("error.password.mismatch"));
  }

  // Report any errors we have discovered back to the original form
  if (!errors.empty()) {
      saveErrors(request, errors);
View Full Code Here

Examples of org.apache.struts.action.ActionError

    validate();
    errorList = (List) requestMap.get("errors");
    ActionErrors actionErrors = null;
    if (errorList != null && !errorList.isEmpty()) {
      actionErrors = new ActionErrors();
      actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("global.error"));
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionError

    validate();
    errorList = (List) requestMap.get("errors");
    ActionErrors actionErrors = null;
    if (errorList != null && !errorList.isEmpty()) {
      actionErrors = new ActionErrors();
      actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("global.error"));
    }
    return actionErrors;
  }
View Full Code Here

Examples of org.apache.struts.action.ActionError

                // Ensure that the requested connector name and port is unique
                if (mBServer.isRegistered(oname) ||
                    (!mBServer.queryNames(search, null).isEmpty())) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("connectorName",
                               new ActionError("error.connectorName.exists"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }

                // Look up our MBeanFactory MBean
View Full Code Here

Examples of org.apache.struts.action.ActionError

                }
                   
                if (mserver.isRegistered(oname)) {
                    ActionErrors errors = new ActionErrors();
                    errors.add("jndiName",
                               new ActionError("resources.invalid.name"));
                    saveErrors(request, errors);
                    return (new ActionForward(mapping.getInput()));
                }       
               
                oname = ResourceUtils.getNamingResourceObjectName(domain,
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.