You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mraible <ma...@raibledesigns.com> on 2007/03/14 06:26:00 UTC
Global messages.jsp file included in a SiteMesh decorator
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>
--
View this message in context: http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9468706
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Missing Message Key
Posted by Syed Ibrahim <sy...@paradyne.co.in>.
Hi I am new to this forum and started using Struts 1.3.5.
Am getting below exception while running my program.
Missing message for key "userRegistration.firstName" in bundle "(default bundle)"
Thanks in Advance.
---------- Original Message -----------
From: "Guillaume Carré" <gu...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wed, 14 Mar 2007 18:06:41 +0100
Subject: Re: Global messages.jsp file included in a SiteMesh decorator
> 2007/3/14, mraible <ma...@raibledesigns.com>:
> > What if you remove the <filter-mapping> for Struts' filter in your web.xml?
>
> ??
> If I remove the Struts' filter nothing works anymore :-)
>
> > I have a staticFilter in my application that forwards to static resources
> > and doesn't hit the Struts FilterDispatcher when one is found. Maybe that's
> > causing my problem?
>
> What if you remove it?
> --
> Guillaume Carré
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
------- End of Original Message -------
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by Guillaume Carré <gu...@gmail.com>.
2007/3/14, mraible <ma...@raibledesigns.com>:
> What if you remove the <filter-mapping> for Struts' filter in your web.xml?
??
If I remove the Struts' filter nothing works anymore :-)
> I have a staticFilter in my application that forwards to static resources
> and doesn't hit the Struts FilterDispatcher when one is found. Maybe that's
> causing my problem?
What if you remove it?
--
Guillaume Carré
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by mraible <ma...@raibledesigns.com>.
Guillaume Carré wrote:
>
> 2007/3/14, mraible <ma...@raibledesigns.com>:
>> What if you use <s:if test="hasActionErrors()"> foo </s:if> - does that
>> work
>> for you as well?
>
> yes it does work as well, as advertized.
>
> And if I remove the ActionContextCleanUp filter, it doesn't work
> anymore, I have the following exception:
>
> java.lang.NullPointerException
> at
> org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
> at
> org.apache.jsp.decorators.main_jsp._jspx_meth_ww_property_0(main_jsp.java:420)
>
> I'm using Tomcat 5.5.17.
>
What if you remove the <filter-mapping> for Struts' filter in your web.xml?
I have a staticFilter in my application that forwards to static resources
and doesn't hit the Struts FilterDispatcher when one is found. Maybe that's
causing my problem?
Matt
--
View this message in context: http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9478424
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by Guillaume Carré <gu...@gmail.com>.
2007/3/14, mraible <ma...@raibledesigns.com>:
> What if you use <s:if test="hasActionErrors()"> foo </s:if> - does that work
> for you as well?
yes it does work as well, as advertized.
And if I remove the ActionContextCleanUp filter, it doesn't work
anymore, I have the following exception:
java.lang.NullPointerException
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:50)
at org.apache.jsp.decorators.main_jsp._jspx_meth_ww_property_0(main_jsp.java:420)
I'm using Tomcat 5.5.17.
--
Guillaume Carré
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by mraible <ma...@raibledesigns.com>.
Guillaume Carré wrote:
>
> 2007/3/14, mraible <ma...@raibledesigns.com>:
>> That's the problem, I *do* have the ActionContextCleanUp filter in my
>> web.xml:
>
> It's working here for me, I've included a test.jsp in my sitemesh
> decorator with a <ww:property value="test"/> in it, and it's able to
> access the test object from the value stack.
>
> But I still have my JSTL problem without the ActionContextCleanUp
> filter, even when I'm not in a sitemesh decorator...
> --
> Guillaume Carré
>
What if you use <s:if test="hasActionErrors()"> foo </s:if> - does that work
for you as well?
Thanks,
Matt
--
View this message in context: http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9477819
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by Guillaume Carré <gu...@gmail.com>.
2007/3/14, mraible <ma...@raibledesigns.com>:
> That's the problem, I *do* have the ActionContextCleanUp filter in my
> web.xml:
It's working here for me, I've included a test.jsp in my sitemesh
decorator with a <ww:property value="test"/> in it, and it's able to
access the test object from the value stack.
But I still have my JSTL problem without the ActionContextCleanUp
filter, even when I'm not in a sitemesh decorator...
--
Guillaume Carré
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by mraible <ma...@raibledesigns.com>.
Guillaume Carré wrote:
>
> 2007/3/14, mraible <ma...@raibledesigns.com>:
>>
>> 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é
>
That's the problem, I *do* have the ActionContextCleanUp filter in my
web.xml:
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>themeFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>staticFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Matt
--
View this message in context: http://www.nabble.com/Global-messages.jsp-file-included-in-a-SiteMesh-decorator-tf3400265.html#a9477319
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Global messages.jsp file included in a SiteMesh decorator
Posted by Guillaume Carré <gu...@gmail.com>.
2007/3/14, mraible <ma...@raibledesigns.com>:
>
> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org