2007/3/14, mraible <[EMAIL PROTECTED]>:

I have a messages.jsp[1] that's included (using <%@ include
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>

You have to add the ActionContextCleanUp filter to your web
application if you wan't to be able to access the value stack from a
sitemesh decorator:
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/ActionContextCleanUp.html

On the same subject, I have opened an issue in JIRA. Without this
filter, I can't access the value stack from JSTL on any JSP page (not
a sitemesh decorator page):
https://issues.apache.org/struts/browse/WW-1798
Do you confirm this?
--
Guillaume Carré

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to