Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a javascript cookie in servlet?

I have tried getting cookie from javascript to servlet using

request.getcookie()

method. But I found the value as null.

Is there any way to get a cookie from javascript to servlet?

like image 889
swetha Avatar asked Nov 02 '22 20:11

swetha


1 Answers

try this

Cookie[] cookies = request.getCookies();


for (int i = 0; i < cookies.length; i++) {
    Cookie c = cookies[i];
     c.getName()  //cookie name
    c.getValue()   //cookie value

  }
like image 142
PSR Avatar answered Nov 08 '22 07:11

PSR