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 <fra...@gmail.com> wrote:

> It work!!
>
> Thanks Chad!
>
> On 5 mar, 01:46, Chad <chad...@gmail.com> 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 <fra...@gmail.com> 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 google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> 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 google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to