How can I know if a viewScope variable has been initialized

耗尽温柔 提交于 2019-12-10 16:19:04

问题


In an application I need to know if a viewScope variable has been initialized. When the viewScope variable is created the value might be null. So viewScope.isEmpty("SomeName") does not tell me that it has been intialized and the answer is null or it has not been initialized yet. None of the viewScope properties seem to answer the question "dose the viewScope exist".


回答1:


You can get the information whether a viewScope variable does exist or not with

if (viewScope.containsKey("SomeName")) ...


来源:https://stackoverflow.com/questions/20501346/how-can-i-know-if-a-viewscope-variable-has-been-initialized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!