|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
if I define method:
public boolean putCookie(HttpServletRequest req, HttpServletResponse resp , String name, String value ) { Cookie c = new Cookie(name, value); c.setMaxAge(3600); c.setDomain("www.office.com"); resp.addCookie(c); return true; } what must be method getCookie? ![]() |
|
#2
|
|||
|
|||
|
How about...
public String getCookie(HttpServletRequest req, String name){ Cookie [] cookies = req.getCookies(); for (int i=0;i<cookies.length;i++){ if (cookies[i].getName().equals(name)) return cookies[i].getValue(); } return null; } |
|
#3
|
|||
|
|||
|
This method will not find mine cookie in domain "www.office.com". How to me to set the domain for reception cookie?
|
|
#4
|
|||
|
|||
|
Not sure about your question...can you be more specific. What I can tell you though is that the cookies have to be set on the same domain that you are reading them from or they will not be readable
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > cookie |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|