title: checking if a bean is null using javascript or other methods
body: <p>The below code snippets work when the values used to create myBean is not null. </p>
  
  <p>How do I take care of the scenario when <code>myBean</code> has null value? Is there a way to check the bean's value?</p>
  
  <pre><code>&lt;bean:define id="myBean" name="&lt;%=myName%&gt;" property="&lt;%=myProp%&gt;"/&gt;
  </code></pre>
  
  <p>now if <code>myName</code> and/or <code>myProp</code> is null, </p>
  
  <p><strong>Error</strong> <code>javax.servlet.jsp.JspException: Define tag cannot set a null value</code> error.</p>
  
  <p><strong>Attempted solution:</strong></p>
  
  <pre><code>&lt;c:if test="${not empty myBean}"&gt;
              &lt;bean:define id="myBean" name="&lt;%=myName%&gt;" property="&lt;%=myProp%&gt;"/&gt;
              &lt;/c:if&gt;
  </code></pre>