Package org.apache.struts2

Examples of org.apache.struts2.Messages


    final TextProvider textProvider = DefaultTextProvider.INSTANCE;
    Map<String, Messages> fieldMap = new HashMap<String, Messages>();
    Map<Severity, List<String>> severityMap = new EnumMap<Severity, List<String>>(Severity.class);

    public Messages forField(String fieldName) {
        Messages forField = fieldMap.get(fieldName);
        if (forField == null) {
            forField = new MessagesImpl();
            fieldMap.put(fieldName, forField);
        }
        return forField;
View Full Code Here


import org.apache.struts2.Messages;

public class MessagesTest extends TestCase {

    public void testForField() {
        Messages messages = new MessagesImpl();
        Messages fieldMessages = messages.forField("foo");
        fieldMessages.addError("foo");
        assertFalse(fieldMessages.getErrors().isEmpty());
        assertTrue(messages.hasErrors());
    }
View Full Code Here

        assertTrue(messages.hasErrors());
    }

    public void testHasMessagesForSeverity() {
        for (Messages.Severity severity : Messages.Severity.values()) {
            Messages messages = new MessagesImpl();
            messages.add(severity, "foo");

            assertFalse(messages.isEmpty(severity));

            for (Messages.Severity other : Messages.Severity.values())
                if (other != severity)
                    assertTrue(messages.isEmpty(other));
        }
    }
View Full Code Here

import org.apache.struts2.Messages;

public class MessagesTest extends TestCase {

    public void testForField() {
        Messages messages = new MessagesImpl();
        Messages fieldMessages = messages.forField("foo");
        fieldMessages.addError("foo");
        assertFalse(fieldMessages.getErrors().isEmpty());
        assertTrue(messages.hasErrors());
    }
View Full Code Here

        assertTrue(messages.hasErrors());
    }

    public void testHasMessagesForSeverity() {
        for (Messages.Severity severity : Messages.Severity.values()) {
            Messages messages = new MessagesImpl();
            messages.add(severity, "foo");

            assertFalse(messages.isEmpty(severity));

            for (Messages.Severity other : Messages.Severity.values())
                if (other != severity)
                    assertTrue(messages.isEmpty(other));
        }
    }
View Full Code Here

    final TextProvider textProvider = DefaultTextProvider.INSTANCE;
    Map<String, Messages> fieldMap = new HashMap<String, Messages>();
    Map<Severity, List<String>> severityMap = new EnumMap<Severity, List<String>>(Severity.class);

    public Messages forField(String fieldName) {
        Messages forField = fieldMap.get(fieldName);
        if (forField == null) {
            forField = new MessagesImpl();
            fieldMap.put(fieldName, forField);
        }
        return forField;
View Full Code Here

    assert (body != null);

    try {
      writer.write(body);
    } catch (IOException e) {
      throw new StrutsException("IOError while writing the body: " + e.getMessage(), e);
    }
    if (popComponentStack) {
      popComponentStack();
    }
    return false;
View Full Code Here

        + getComponentName()
        + "', field '"
        + field
        + (parameters != null && parameters.containsKey("name") ? "', name '"
            + parameters.get("name") : "") + "': " + errorMsg;
    throw new StrutsException(msg, e);
  }
View Full Code Here

      }
      try {
        objectFactory.getClassInstance(actionClass.getName());
      } catch (ClassNotFoundException e) {
        logger.error("Object Factory was unable to load class {}", actionClass.getName());
        throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(),
            e);
      }
      String[] beanNames = beanNameFinder.getBeanNames(actionClass);
      switch (beanNames.length) {
      case 0:
View Full Code Here

                if(it.hasNext()) {
                    sb.append("&");
                }
            }
            } catch (UnsupportedEncodingException e) {
                throw new StrutsException("Encoding "+ENCODING+" not found");
            }
        }
        RenderResponse resp = PortletActionContext.getRenderResponse();
        RenderRequest req = PortletActionContext.getRenderRequest();
        return resp.encodeURL(req.getContextPath() + sb.toString());
View Full Code Here

TOP

Related Classes of org.apache.struts2.Messages

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.