Session getAttribute(“key”)返回-1

Session getAttribute(“key”)返回-1,session,session-variables,Session,Session Variables,我有一个名为tempSessionKey的会话变量。 起初,我没有在这个变量中设置任何值 但在JSP页面中,我试图通过以下方式获取值:session.getAttributetempSessionKey 我期望一个空值,但总是得到-1 有什么问题 请帮帮我 提前感谢。也请分享您的代码。这是我的代码:int count=0;ifsession.getAttributetempSessionKey==null{count=0;}

我有一个名为tempSessionKey的会话变量。 起初,我没有在这个变量中设置任何值

但在JSP页面中,我试图通过以下方式获取值:session.getAttributetempSessionKey

我期望一个空值,但总是得到-1

有什么问题

请帮帮我


提前感谢。

也请分享您的代码。这是我的代码:int count=0;ifsession.getAttributetempSessionKey==null{count=0;}