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/src/
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