David, >Why does TestActionBean's goToTest2() method perform no flash scope magic? Because you are doing it wrong... ;) Read JavaDoc of "flash" method... it *returns* RedirectResolution and it does not mutate existing object... RedirectResolution rr = new RedirectResolution(Test2ActionBean.class); rr.flash(this); return rr; <-- wrong
Instead do:
RedirectResolution rr = new RedirectResolution(Test2ActionBean.class);
return rr.flash(this);
regards,
Ruslan
________________________________
From: [EMAIL PROTECTED] on behalf of David G Friedman
Sent: Thu 4/10/2008 3:06 AM
To: Stripes Users List
Subject: Re: [Stripes-users] A FlashScope test case I expected to work
I'll bite. Why does TestActionBean's goToTest2() method perform no flash scope
magic? Doesn't it need something kind of like this:
RedirectResolution rr = new RedirectResolution(Test2ActionBean.class);
rr.flash(this);
return rr;
Regards,
David
Dan Kaplan wrote:
I'm using the latest version of stripes (got it from svn 4/9/2008) and
I have been having a lot of trouble with FlashScope. I got to a point where I
made a test case that I expected to work but it doesn't. Please let me know
what I'm doing wrong
When I click on the link on test1.jsp, test2.jsp always displays this:
[]
0
I'm expecting it to say this:
["This is a message."]
1
-------------------test1.jsp
<%@ page contentType="text/html;charset=iso-8859-1" language="java" %>
<%@ taglib prefix="stripes"
uri="http://stripes.sourceforge.net/stripes.tld"
<http://stripes.sourceforge.net/stripes.tld> %>
<html>
<body>
<stripes:link
beanclass="com.haverlocke.tellah.web.actionbean.Test1ActionBean">add to
flash</stripes:link>
</body>
</html>
----------------- test2.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="stripes"
uri="http://stripes.sourceforge.net/stripes.tld"
<http://stripes.sourceforge.net/stripes.tld> %>
<[EMAIL PROTECTED] prefix="fn"
uri="http://java.sun.com/jsp/jstl/functions"
<http://java.sun.com/jsp/jstl/functions> %>
<html>
<body>
${actionBean.context.messages}<br/>
${fn:length(actionBean.context.messages)}
</body>
</html>
------------------- Test1ActionBean.java
public class Test1ActionBean implements ActionBean {
private ActionBeanContext context;
public ActionBeanContext getContext() {return context;}
public void setContext(ActionBeanContext context) {this.context =
context;}
@DefaultHandler
public Resolution goToTest2() {
context.getMessages().add(new SimpleMessage("This is a
message."));
return new RedirectResolution(Test2ActionBean.class);
}
}
------------------- Test2ActionBean.java
public class Test2ActionBean implements ActionBean{
private ActionBeanContext context;
public ActionBeanContext getContext() {return context;}
public void setContext(ActionBeanContext context) {this.context =
context;}
@DefaultHandler
public Resolution goToTest2() {
return new ForwardResolution("/jsp/test2.jsp");
}
}
What am I doing wrong?
Thanks
________________________________
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
________________________________
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
***************************************************************************************************
The information in this email is confidential and may be legally privileged.
Access to this email by anyone other than the intended addressee is
unauthorized. If you are not the intended recipient of this message, any
review, disclosure, copying, distribution, retention, or any action taken or
omitted to be taken in reliance on it is prohibited and may be unlawful. If you
are not the intended recipient, please reply to or forward a copy of this
message to the sender and delete the message, any attachments, and any copies
thereof from your system.
***************************************************************************************************
<<winmail.dat>>
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
