简体   繁体   中英

How do I check that a session object contains a particular key/value entry

I want to check if a certain key/value pair has been set.

How do I check if a an entry with key named "keyName" exists. Sample code or a pointer to an example would be appreciated.

如果要在“未设置”和null之间进行session.getAttributeNames() ,请逐步执行session.getAttributeNames()并搜索您的密钥名称。

Heres a simple introductory tutorial to JSP Sessions

In essence you should just need to check that session.getAttribute("keyName") is not null.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM