Thanks Howard. I figured I didn't need it on the currentMessage field,
but I didn't want the flex response from someone saying I should try
adding it. ;-)
Either way, the "messages" field is still sticking around past a single
page load.
The pertinent java code that uses it is:
@Component
private Messages messages;
Object onActionFromDownloadDistrict(String districtId) {
messages.addMessage("Last successful download: District " +
districtId);
return null;
}
And of course the html:
<t:messages/>
Anything else I'm missing? Is flash persistence available in 5.0.4?
-----Original Message-----
From: Howard Lewis Ship [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 15, 2007 1:48 PM
To: Tapestry users
Subject: Re: T5: Flash persistence strategy
You don't need the @Meta, you can:
@Persist("flash")
private List<String> messages = new ArrayList<String>();
Also, you don't need the @Persist on the currentMessage field.
On 5/15/07, Joel Wiegman <[EMAIL PROTECTED]> wrote:
>
> Greetings all,
>
> I attempted to expand upon the T5 "FlashDemo" found here:
>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/sr
> c/
> test/app1/WEB-INF/
>
> I'm attempting to write a "Messages" component that can be included
> anywhere and show a group of messages to a user.
>
> But for some reason the messages are persisting past a single-page
> rendering, despite using the new "flash" persistence strategy (which
> I'm assuming is available in 5.0.4). Can anyone spot the flaw?
Thanks!
>
> "Messages" component:
>
> @Meta("tapestry.persistence-strategy=flash")
> public class Messages {
>
> @Persist
> private List<String> messages = new ArrayList<String>();
>
> @Persist
> private String currentMessage;
>
> public List<String> getMessages()
> {
> return messages;
> }
>
> public void addMessage(String message) {
> messages.add(message);
> }
>
> public String getCurrentMessage() {
> return currentMessage;
> }
>
> public void setCurrentMessage(String currentMessage) {
> this.currentMessage = currentMessage;
> }
>
> }
>
> "Messages" template:
>
> <t:if test="messages"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <ul>
> <li t:type="loop" source="messages"
> value="currentMessage">
> ${currentMessage}
> </li>
> </ul>
> </t:if>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant Creator and PMC Chair,
Apache Tapestry Creator, Apache HiveMind
Professional Tapestry training, mentoring, support and project work.
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]