Package org.apache.struts.action

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


                                 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

  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

    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

    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

                // 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

                }
                   
                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

             server socket on *all* IP addresses for this host */
            if ((address.length() > 0) && !address.equalsIgnoreCase(" ")) {
                try {
                    InetAddress.getByName(address);
                } catch (Exception e) {
                    errors.add("address", new ActionError("error.address.invalid"));
                }
            } else {
                address = " ";
            }
           
            /* ports */
            numberCheck("portNumber",  portText, true, 1, 65535);
            numberCheck("redirectPortText",  redirectPortText, true, -1, 65535);
           
            /* processors*/
            //numberCheck("minProcessorsText",  minProcessorsText, true, 1, 512);
            //try {
                // if min is a valid integer, then check that max >= min
                //int min = Integer.parseInt(minProcessorsText);
                //numberCheck("maxProcessorsText",  maxProcessorsText, true, min, 512);
            //} catch (Exception e) {
                // check for the complete range
                //numberCheck("maxProcessorsText",  maxProcessorsText, true, 1, 512);
            //}
           
            // proxy                 
            if ((proxyName!= null) && (proxyName.length() > 0)) {
                try {
                    InetAddress.getByName(proxyName);
                } catch (Exception e) {
                    errors.add("proxyName", new ActionError("error.proxyName.invalid"));
                }
            }  
           
            // supported only by Coyote HTTP and HTTPS connectors
            if (!("AJP".equalsIgnoreCase(connectorType))) {
View Full Code Here

    public 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

                // 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

TOP

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

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.