Package org.apache.struts.action

Examples of org.apache.struts.action.ActionError


                (name, PageContext.REQUEST_SCOPE);
      if (value == null) {
    ;
      } else if (value instanceof String) {
    errors.add(ActionErrors.GLOBAL_ERROR,
                           new ActionError((String) value));
      } else if (value instanceof String[]) {
                String keys[] = (String[]) value;
                for (int i = 0; i < keys.length; i++)
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError(keys[i]));
            } else if (value instanceof ErrorMessages) {
    String keys[] = ((ErrorMessages) value).getErrors();
                if (keys == null)
                    keys = new String[0];
                for (int i = 0; i < keys.length; i++)
                    errors.add(ActionErrors.GLOBAL_ERROR,
                               new ActionError(keys[i]));
            } else if (value instanceof ActionErrors) {
                errors = (ActionErrors) value;
      }
        } catch (Exception e) {
            ;
  }
        if (errors.empty())
      return (EVAL_BODY_INCLUDE);

  // Render the error messages appropriately
  Locale locale = null;
  try {
      locale = (Locale) pageContext.getAttribute
    (Action.LOCALE_KEY, PageContext.SESSION_SCOPE);
  } catch (IllegalStateException e) {  // Invalidated session
      locale = null;
  }
  if (locale == null)
      locale = defaultLocale;
  MessageResources messages = (MessageResources)
    pageContext.getAttribute(Action.MESSAGES_KEY,
           PageContext.APPLICATION_SCOPE);
  String message = null;
  StringBuffer results = new StringBuffer();
  message = messages.getMessage(locale, "errors.header");
  if (message != null) {
      results.append(message);
      results.append("\r\n");
  }
        Iterator reports = errors.get();
        while (reports.hasNext()) {
            ActionError report = (ActionError) reports.next();
      message =
                messages.getMessage(locale,
                                    report.getKey(), report.getValues());
      if (message != null) {
    results.append(message);
    results.append("\r\n");
      }
  }
View Full Code Here


            // check for portNumber -- must not be blank, must be in
            // the range 1 to 65535.
           
            if ((portNumberText == null) || (portNumberText.length() < 1)) {
                errors.add("portNumberText",
                new ActionError("error.portNumber.required"));
            } else {
                try {
                    int port = Integer.parseInt(portNumberText);
                    if ((port <= 0) || (port >65535 ))
                        errors.add("portNumberText",
                            new ActionError("error.portNumber.range"));
                } catch (NumberFormatException e) {
                    errors.add("portNumberText",
                        new ActionError("error.portNumber.format"));
                }
            }
       
            // shutdown text can be any non-empty string of atleast 6 characters.
           
            if ((shutdownText == null) || (shutdownText.length() < 7))
                errors.add("shutdownText",
                new ActionError("error.shutdownText.length"));
           
        //}
       
        return errors;
       
View Full Code Here

        //if (submit != null) {
            // the following fields are required.

            if ((connectionURL == null) || (connectionURL.length() < 1)) {
                errors.add("connectionURL",
                new ActionError("error.connURL.required"));
            }

            // Either userPattern or userSearch should be specified not both
            boolean isUserPatternSpecified = false;
            boolean isUserSearchSpecified = false;
            if ((userPattern != null) && (userPattern.length() > 0)) {
                isUserPatternSpecified = true;
            }

            if ((userSearch != null) && (userSearch.length() > 0)) {
                isUserSearchSpecified = true;
            }

            if (isUserPatternSpecified && isUserSearchSpecified) {
                errors.add("userPattern" ,
                new ActionError("error.userPattern.userSearch.defined"));
            }

            /*if ((digest == null) || (digest.length() < 1)) {
                errors.add("digest",
                new ActionError("error.digest.required"));
View Full Code Here

                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()));
                }

                String domain = oname.getDomain();
View Full Code Here

         //if (submit != null) {
             // the following fields are required.
           
            if ((dataSourceName == null) || (dataSourceName.length() < 1)) {
                errors.add("dataSourceName",
                new ActionError("error.dataSourceName.required"));
            }
        
            if ((roleNameCol == null) || (roleNameCol.length() < 1)) {
                errors.add("roleNameCol",
                new ActionError("error.roleNameCol.required"));
            }

            if ((userCredCol == null) || (userCredCol.length() < 1)) {
                errors.add("userCredCol",
                new ActionError("error.userCredCol.required"));
            }
       
            if ((userNameCol == null) || (userNameCol.length() < 1)) {
                errors.add("userNameCol",
                new ActionError("error.userNameCol.required"));
            }
           
            if ((userRoleTable == null) || (userRoleTable.length() < 1)) {
                errors.add("userRoleTable",
                new ActionError("error.userRoleTable.required"));
            }
       
            if ((userTable == null) || (userTable.length() < 1)) {
                errors.add("userTable",
                new ActionError("error.userTable.required"));
            }
           
        //}
                
        return errors;
View Full Code Here

                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()));
                }

                String domain = oname.getDomain();
View Full Code Here

                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()));
                }

                String domain = oname.getDomain();
View Full Code Here

                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()));
                }

                String domain = oname.getDomain();
View Full Code Here

                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()));
                }
               
                String domain = oname.getDomain();
View Full Code Here

       
        // front end validation when save is clicked.
        //if (submit != null) {
            if ((resource == null) || (resource.length() < 1)) {
                errors.add("resource",
                new ActionError("error.resource.required"));
            }
        //}
        return errors;
    }
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.