...
...
alert("${pageContext.request.session.id}");
...
...
ที่ web.xml
...
...
...
<session-config>
<session-timeout>
30
</session-timeout>
<cookie-config>
<name>ASGRILEID</name>
<path>/</path>
<comment>expire 30 minute</comment>
<http-only>true</http-only>
<secure>false</secure>
<max-age>1800</max-age>
</cookie-config>
</session-config>
...
...
...
การจัดเรียง attribute cookie จะต้องเรียงแบบนี้เท่านัั้น ห้ามสลับไปสลับมา ไม่งั้นจะ run application ไม่ผ่านcookie-config
1. name : ตั้งว่าอะไรก็ได้ ซึ่งมันจะมาแทน (replace) JSESSIONID
2. path : เป็น path ของ cookie นั้น
3. comment
4. http-only : ให้ cookie นี้ใช้ได้กับ http เท่านั้น
5. secure : บอกว่าเป็น http (false) หรือ https (true)
6. max-age : cookie expire หน่วยเป็น วินาที (second)


ไม่มีความคิดเห็น:
แสดงความคิดเห็น