I want to be develop a blackberry application.That used an external DB through webservice call.I am choosing blackberry web works for developing this.I want to store a userid in phone like session after logged in a user.How use session management in BB webworks?
help is highly appreciated.
Thanks,
Comp
You can use either SQLlite or Cookies. Cookies are extremly useful and easy to implement for non critical data:
function setCookie(c_name,value,exdays){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
try{
document.cookie=c_name + "=" + c_value;
}catch(e){
alert('exception: ' + e.name + '; ' + e.message);
}
}
function getCookie(c_name){
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{
return unescape(y);
}
}
}
Good luck!