我如何知道viewScope变量是否已初始化

我如何知道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")) ...