Hi,
i guess it would be useful.
public static void setCookie(String pSessionId){
Date lCurrentDate = new Date();
long lCurrentTime = lCurrentDate.getTime();
lCurrentTime = lCurrentTime+(1000*60*30); //30 min
lCurrentDate.setTime(lCurrentTime);
Cookies.setCookie("session", pSessionId, lCurrentDate, null, "/",
false);
}
public static String getCookie(){
return Cookies.getCookie("session");
}
Thanks,
Malli.
On Sat, Mar 6, 2010 at 8:40 AM, Fran <[email protected]> wrote:
> It work!!
>
> Thanks Chad!
>
> On 5 mar, 01:46, Chad <[email protected]> wrote:
> > Fran,
> >
> > Try putting an L after at least one of the numbers in parentheses:
> >
> > nowLong = nowLong + (1000L * 60 * 60 * 24 * 30); // 30 dias
> >
> > HTH,
> > Chad
> >
> > On Mar 4, 4:25 pm, Fran <[email protected]> wrote:
> >
> > > I cant write a cookie in GWT.
> >
> > > This is the code:
> >
> > > String ckValue =
> Cookies.getCookie("nameCookie");
> > > if(ckValue == null){
> > > Date now = new Date();
> > > long nowLong = now.getTime();
> > > nowLong = nowLong + (1000 * 60 * 60 *
> 24 * 30);// 30 dias
> > > now.setTime(nowLong);
> >
> > > Cookies.setCookie("nameCookie",
> "valueCookie", now);
> > > }
> >
> > > Always ckValue is null.
> >
> > > Anybody know this problem?
> > > Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.