title: JSP - Can I use <jsp:attribute> inside <c:if>? Exception: "Must use jsp:body to specify tag body"
body: <p>I have the following inside a JSP:</p>
  
  <pre><code>&lt;c:if test="${true}"&gt;
  &lt;jsp:attribute name="extraInlineComplianceJavascript"&gt;
  window.isSummaryComplianceLinkVisible = '${TabList.isSummaryComplianceLinkVisible}';
  window.isDetailComplianceLinkVisible = '${TabList.isDetailComplianceLinkVisible}';
  window.complianceSummaryReportTag = '${helper.complianceSummaryReportTag}';
  window.complianceDetailReportTag = '${helper.complianceReportTag}';
  &lt;/jsp:attribute&gt;
  &lt;/c:if&gt;
  </code></pre>
  
  <p>As is, I get the following exception:</p>
  
  <pre><code> Must use jsp:body to specify tag body for &amp;lt;MyTag if jsp:attribute is used.
  </code></pre>
  
  <p>If I remove the outermost <code>&lt;c:if&gt;</code> tags, it works. Is there a problem with using <code>&lt;jsp:attribute&gt;</code> inside a <code>&lt;c:if&gt;</code> ? Any help would be appreciated. Thanks.</p>