So, I take Alex's question to be something like this:

"I want to set a cookie in an action and have that key/value be recognized
*both* in the immediately succeeding screen and in future sessions.  I have
the future sessions part handled (cookies), but I can't figure out the
immediate screen part."

I am not a highly experienced Turbine user, so there might be a better way,
but I have sent key/value pairs from actions to screens using
data.getParameters().add("key","value").

E.G.

//Action
public void doIncrease(RunData data, Context, context)
        throws Exception
{

        int newFontSize = oldFontSize + 2;
        CookieParser cp = data.getCookies();
        cp.set("fontsize",newFontSize );
        data.getParameters().add("fontsize",newFontsize);
        data.setScreenTemplate( "NextTemplate.vm" );
}

I can then access "fontsize" in the NextTemplate screen using
data.getParameters().toInt("fontsize",1);

You will probably have to play with your screens to attempt getting the
value from the cookie, and then the data parameters if the cookie fails.  I
haven't ever had to use cookies, so I am inexperienced in that area.

Hope this helps,

Chris

-----Original Message-----
From: Alexander Banthien [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 8:10 AM
To: Turbine Users List
Subject: Re: Cookies in Actions and Screens


Hi Alex,

that is precisely what is happening. Is the CookieParser which I retrieve in
the
screen class not the same as the one which I manipulated in the action
class?

Alex

Alex McLintock wrote:

> At 14:19 01/07/02, Alexander Banthien wrote:
> >So my question remains: why is the cookie which I set in an Action not
> >visible to
> >the Screen immediately, but only after page refresh?
>
> You set the cookie in the action....this gets sent to the user's browser,
> and you are not seeing it in the template of the same request? Well why
> should you? The cookie wont get sent back to the webapp until the next
> request....
>
> Is that what's happening?
>
> Alex
>

Mit freundlichen Gr��en
Alexander Banthien

_______________________________________
Questech GmbH
Schwarzwaldstr. 19
79199 Kirchzarten

Fon: +49 (0)7661 90 35-15
Fax: +49 (0)7661 90 35-20
www.questech.de

_______________________________________




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to