Package org.apache.struts.action

Examples of org.apache.struts.action.ActionError


                                               
                // Ensure that the requested connector name is unique
                if (mBServer.isRegistered(oname)) {
                    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


             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

        if (log.isTraceEnabled()) {
            log.trace(" 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 (log.isTraceEnabled()) {
            log.trace(" Performing extra validations");
        }
  String value = null;
  value = regform.getUsername();
  if (("Create".equals(action)) &&
            (database.findUser(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.isEmpty()) {
View Full Code Here

        ActionErrors errors = super.validate(mapping, request);

        // Only need crossfield validations here
        if (!password.equals(password2)) {
            errors.add("password2",
                       new ActionError("error.password.match"));
        }
        return errors;

    }
View Full Code Here

            PropertyUtils.getSimpleProperty(form, "password");
  UserDatabase database = (UserDatabase)
    servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
  if (database == null)
            errors.add(ActionErrors.GLOBAL_ERROR,
                       new ActionError("error.database.missing"));
  else {
      user = getUser(database, 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.isEmpty()) {
      saveErrors(request, errors);
View Full Code Here

     
        super.authenticate(request,username,password);

    } catch (Exception e) {
     
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("logon.error.badLogin"));
      saveErrors(request, errors);
      return (mapping.getInputForward());
     
    }  
   
View Full Code Here

        // add user as an administrator of the group
        group.removeAdministrator(u);
         
       
    } catch (NotFoundException e) {
      errors.add("general"new ActionError("groupUser.error.notFound"));           
       
    } catch (Exception e) {
      String eid=this.getClass().getName()+"_"+System.currentTimeMillis();
      log.error("eid:"+eid+"\nsessionID" +request.getSession().getId(),e;     
      errors.add("general"new ActionError("error.general","erreur id:"+eid));           
    }
   
    if (!errors.isEmpty()) {
        saveErrors(request, errors);
      return mapping.findForward("success");
View Full Code Here

          ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
          ProfileManager manager = forumFactory.getProfileManager();
          Forum f = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
          forumFactory.deleteForum(f);
         
          errors.add("general"new ActionError("delForum.confirm"));
         
        }
        catch( NotFoundException fnfe ) {
          errors.add("general"new ActionError("delForum.notFound"));         
        }
        catch( UnauthorizedException ue ) {
          errors.add("general"new ActionError("delForum.unauthorized"));
        }
       
    } catch (Exception e) {
      String eid=this.getClass().getName()+"_"+System.currentTimeMillis();
      log.error("eid:"+eid +"\nsessionID" +request.getSession().getId(),e;     
      errors.add("general"new ActionError("error.general","error id:"+eid));           
    }
   
    saveErrors(request, errors);

    return mapping.findForward("success");
View Full Code Here

        request.setAttribute("isCacheEnabled",new Boolean(cacheManager.isCacheEnabled()));
       
    } catch (Exception e) {
      String eid=this.getClass().getName()+"_"+System.currentTimeMillis();
      log.error("eid:"+eid +"\nsessionID" +request.getSession().getId(),e;     
      errors.add("general"new ActionError("error.general","error id:"+eid));           
    }
   
    saveErrors(request, errors);

    return mapping.findForward("view");
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.