我如何找到值在会话中是否设置为变量?
if(session.getAttribute("tot_demand"))//need to change
//if value is already set then do this.
else
//if not set then do this.
Run Code Online (Sandbox Code Playgroud)
我需要写什么,以使上述代码有效?
比较null:
if (session.getAttribute("tot_demand") != null) {
// already set
} else {
// not yet set
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1453 次 |
| 最近记录: |