Displays one of two possible outputs, depending on whether its input parameter is empty.

Class Name




Required Input Parameters


The value to test. The value parameter is tested to determine if it is empty, and the result of this test determines the name of the open parameter to render. For example, if the value parameter is empty, then IsEmpty renders the value of its true open parameter.

Open Parameters


The value to render if the value parameter is empty.


The value to render if the value parameter is not empty.

Usage Notes

IsEmpty conditionally renders one of its open parameters based on the value of its value input parameter. If value is null or if the object is empty, then the output parameter true is rendered. Otherwise, the output parameter false is rendered.

The meaning of empty depends on the data type of the value parameter:

Data type

Considered empty if...


Collection.isEmpty returns true

object array

Object[].length == 0


Map.isEmpty returns true


Map.isEmpty returns true


String.equals("") returns true


The following example displays the a user’s hobbies, using ForEach to render them. If a user identifies no hobbies, a message displays:

<dsp:droplet name="IsEmpty">
   <dsp:param name="value" bean="MyProfile.hobbies"/>
   <dsp:oparam name="false">
      Your hobbies are:
        <dsp:droplet name="ForEach">
           <dsp:param name="array" bean="MyProfile.hobbies"/>
           <dsp:oparam name="output">
              <dsp:valueof param="element"/>
   <dsp:oparam name="true">
      All work and no play makes Jack a dull boy.

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices