We are working with java-gwt application. We are using cookies along with all the modules in the application. In some cases i need to get the value from cookie before setting cookie.
String demoId = Cookie.get("demoId");
In the above code i am getting 'undefined' as demoId. How to handle this in java, because the 'undefined' is specific to javascript.
From GWT/Java point of view, JavaScript's null
and undefined
are the same: they're Java null
. Of course they behave differently when running your app (such as when "stringifying" them) but in 99.999% of the cases they just behave the same (note that in JS (null == undefined) === true
).
So just use an == null
in Java and it'll work the same whether the value actually is a JS null
or undefined
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.