@Test public void testWithoutError() throws Exception { JseMessagesTag tag = new JseMessagesTag(); tag.setJspContext(page); tag.doTag(); assertThat(response.getContentAsString(), is("")); }
@Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringBuilder buffer = new StringBuilder(); for (String key : MessageContext.MESSAGES_KEY) { Messages messages = extractMessagesAsList(key); if (messages != null && !messages.isEmpty()) { switch (messages.getMessageType()) { case ERROR: printMessages(buffer, messages.getMessageItemList(), ERROR_PREFIX, ERROR_SUFFIX); break; case INFORMATION: printMessages(buffer, messages.getMessageItemList(), INFO_PREFIX, INFO_SUFFIX); break; case VALIDATION: default: printMessages(buffer, messages.getMessageItemList(), VALIDATION_PREFIX, VALIDATION_SUFFIX); break; } } } if (!onlyMsg && buffer.length() > 0) { out.print(HEADER + buffer.toString() + FOOTER); } else { out.print(buffer.toString()); } }
JseMessagesTag extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringBuilder buffer = new StringBuilder(); for (String key : MessageContext.MESSAGES_KEY) { Messages messages = extractMessagesAsList(key); if (messages != null && !messages.isEmpty()) { switch (messages.getMessageType()) { case ERROR: printMessages(buffer, messages.getMessageItemList(), ERROR_PREFIX, ERROR_SUFFIX); break; case INFORMATION: printMessages(buffer, messages.getMessageItemList(), INFO_PREFIX, INFO_SUFFIX); break; case VALIDATION: default: printMessages(buffer, messages.getMessageItemList(), VALIDATION_PREFIX, VALIDATION_SUFFIX); break; } } } if (!onlyMsg && buffer.length() > 0) { out.print(HEADER + buffer.toString() + FOOTER); } else { out.print(buffer.toString()); } } }
JseMessagesTag extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringBuilder buffer = new StringBuilder(); for (String key : MessageContext.MESSAGES_KEY) { Messages messages = extractMessagesAsList(key); if (messages != null && !messages.isEmpty()) { switch (messages.getMessageType()) { case ERROR: printMessages(buffer, messages.getMessageItemList(), ERROR_PREFIX, ERROR_SUFFIX); break; case INFORMATION: printMessages(buffer, messages.getMessageItemList(), INFO_PREFIX, INFO_SUFFIX); break; case VALIDATION: default: printMessages(buffer, messages.getMessageItemList(), VALIDATION_PREFIX, VALIDATION_SUFFIX); break; } } } if (!onlyMsg && buffer.length() > 0) { out.print(HEADER + buffer.toString() + FOOTER); } else { out.print(buffer.toString()); } } JseMessagesTag(); }
JseMessagesTag extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringBuilder buffer = new StringBuilder(); for (String key : MessageContext.MESSAGES_KEY) { Messages messages = extractMessagesAsList(key); if (messages != null && !messages.isEmpty()) { switch (messages.getMessageType()) { case ERROR: printMessages(buffer, messages.getMessageItemList(), ERROR_PREFIX, ERROR_SUFFIX); break; case INFORMATION: printMessages(buffer, messages.getMessageItemList(), INFO_PREFIX, INFO_SUFFIX); break; case VALIDATION: default: printMessages(buffer, messages.getMessageItemList(), VALIDATION_PREFIX, VALIDATION_SUFFIX); break; } } } if (!onlyMsg && buffer.length() > 0) { out.print(HEADER + buffer.toString() + FOOTER); } else { out.print(buffer.toString()); } } JseMessagesTag(); void setFilter(boolean filter); void setOnlyMsg(boolean onlyMsg); void setPath(String path); void setIgnorePath(String ignorePath); void setModelName(String modelName); void setScope(String scope); @Override void doTag(); }
JseMessagesTag extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringBuilder buffer = new StringBuilder(); for (String key : MessageContext.MESSAGES_KEY) { Messages messages = extractMessagesAsList(key); if (messages != null && !messages.isEmpty()) { switch (messages.getMessageType()) { case ERROR: printMessages(buffer, messages.getMessageItemList(), ERROR_PREFIX, ERROR_SUFFIX); break; case INFORMATION: printMessages(buffer, messages.getMessageItemList(), INFO_PREFIX, INFO_SUFFIX); break; case VALIDATION: default: printMessages(buffer, messages.getMessageItemList(), VALIDATION_PREFIX, VALIDATION_SUFFIX); break; } } } if (!onlyMsg && buffer.length() > 0) { out.print(HEADER + buffer.toString() + FOOTER); } else { out.print(buffer.toString()); } } JseMessagesTag(); void setFilter(boolean filter); void setOnlyMsg(boolean onlyMsg); void setPath(String path); void setIgnorePath(String ignorePath); void setModelName(String modelName); void setScope(String scope); @Override void doTag();  }