开发者

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

开发者 https://www.devze.com 2022-12-10 17:24 出处:网络
I want to check if a certain key/value pair has be开发者_如何学Goen 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.If

I want to check if a certain key/value pair has be开发者_如何学Goen 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.


If you want to differ between "not set" and null, step through session.getAttributeNames() and search your key name.


Heres a simple introductory tutorial to JSP Sessions

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

0

精彩评论

暂无评论...
验证码 换一张
取 消