我如何知道viewScope变量是否已初始化 [英] How can I know if a viewScope variable has been initialized

查看:92
本文介绍了我如何知道viewScope变量是否已初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中,我需要知道viewScope变量是否已初始化.创建viewScope变量时,该值可能为null.因此,viewScope.isEmpty("SomeName")不会告诉我它已经初始化并且答案为null或尚未初始化.所有viewScope属性似乎都无法回答存在viewScope的剂量"这个问题.

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".

推荐答案

您可以通过以下信息获取有关viewScope变量是否存在的信息

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

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

这篇关于我如何知道viewScope变量是否已初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆