Hi Aaron:

I need to keep the original domain object for reference in the test.jsp, hence 
I use flash().

Yes, by changing the stripes.properties file I can get it working, but it's 
still a little bit weird to me
that I can not detect if there's any message available at page rendering time.

The other shortcoming for property file is that I may have different layout for 
messages in different jsps,
So simply specify a single style for all of them is not an appropriate option.

I will still working on it to see if there's any solution.
Thank you for your help.


Regards,
Hubert

-----Original Message-----
From: Aaron Porter [mailto:[email protected]] 
Sent: Friday, July 31, 2009 11:31 PM
To: Stripes Users List
Subject: Re: [Stripes-users] Weird behavior for flash scope and stripes 
messages tag

Hi Hubert,
You shouldn't have to flash(this) to get messages to go through.

The easiest thing to do is drop the <c:if> and <div class="success"> so 
you just have <s:messages /> in your JSP. Then edit 
StripesResources.properties and change the stripes.messages.* properties 
to whatever you want to wrap the messages with.

Maybe something like this for what you're trying to do:


stripes.messages.header=<div class="success"><ul>
stripes.messages.beforeMessage=<li>
stripes.messages.afterMessage=</li>
stripes.messages.footer=</ul></div>

Aaron


Hubert Yang wrote:
> Hi all:
>
> In one of my events I first add some message, and then redirect the page by
> flash scope:
>
> getContext().addMessage(“…”);
> return createRedirect(“/jsp/test.jsp”).flash(this);
>
> And in the jsp file above, I try to display the message if any:
>
> <%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld"; %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
> //…
> <c:if test="${!empty actionBean.context.messages}">
>                 <div class="success"><s:messages /></div>
> </c:if>
> //…
>
> However, a NullPointerException is thrown after doing this, I debug into
> Stripes code only find that
> the returned FlashScope is null:
> ActionBeanContext.getMessages(ActionBeanContext.java:191)
>
> But if I remove the c:if tag and use <s:messages /> only, everything works
> fine.
>
> Is there any logical explanation for this?  How should I detect whether
> there is any message in the context?
>
> Thanks a lot
>
> Best Regards,
> Hubert
>   


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to