1

Based on the GWT ShowCase example (http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCookies) we can only store a Pair of String name - String value to Cookies.

What if we want to store a Triad such as (String ItemName, String ItemID, String CompanyID)? or even Foursome, FiveSome, SixSome.... of Info?

We can't set String Array for value in GWT Cookies

Cookies.setCookie(name, value, expires);

So How to use Gwt Cookies in that case?

Kiti
  • 483
  • 5
  • 18

1 Answers1

1

A cookie is a key/value pair of strings, kinda like you'd do in a Java properties file. You can make some method that serializes/deserializes an array into a string and vice versa.

You can use the method described here to easily convert between Strings and arrays: string to string array conversion in java

And you can use Arrays.toString(array); to parse an array to a String. Concatenating elements in an array to a string

Community
  • 1
  • 1
Churro
  • 3,416
  • 3
  • 21
  • 24