Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Global messages.jsp file included in a SiteMesh decorator

Matt Raible

2007-03-14

Replies:


I have a messages.jsp[1] that's included (using <%@(protected)
file="/common/messages.jsp" %>) in my default decorator. This file has a
couple of calls to the valueStack - namely hasActionErrors() and
hasFieldErrors(). This worked fine in WebWork 2.1.x and Struts 2.0.1 - even
when pages where rendered that didn't go through Struts. However, starting
with the 2.0.6 release, the <s:if> tag throws a NPE because the ValueStack
isn't in the request. I believe it's a bug, but wanted to check with this
list first to confirm.

Thanks,

Matt

[1] messages.jsp:

<% if (request.getAttribute("struts.valueStack") != null) { %>
<s:if test="hasActionErrors()">
  <div class="error" id="errorMessages">
   <s:iterator value="actionErrors">
     <c:url value= "
       alt="<fmt:message key="icon.warning"/>" class="icon" />
    <s:property escape="false"/><br />
   </s:iterator>
 </div>
</s:if>

<s:if test="hasFieldErrors()">
  <div class="error" id="errorMessages">
   <s:iterator value="fieldErrors">
      <s:iterator value="value">
        <c:url value= "
          alt="<fmt:message key="icon.warning"/>" class="icon" />
        <s:property escape="false"/><br />
      </s:iterator>
   </s:iterator>
 </div>
</s:if>
<% } %>

<%-- Success Messages --%>
<c:if test="${not empty messages}">
  <div class="message" id="successMessages">
    <c:forEach var="msg" items="${messages}">
        <c:url value= "
          alt="<fmt:message key="icon.information"/>" class="icon" />
       <c:out value="${msg}" escapeXml="false"/><br />
    </c:forEach>
  </div>
  <c:remove var="messages" scope="session"/>
</c:if>

--
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.