title: Adding a css file to the <head> element in a jsp file?
body: <p>I have been searching the net for the last hour but I can't see how to add a css file to the <code>&lt;head&gt;</code> element of a page.</p>
  
  <p>Say I have a jsp called shopping.jsp. And inside it I conditionally include a jsp tag file called products.tag.</p>
  
  <p>I want products.jsp to specify a css file to add to the head element of the page. How can this be done?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This code is simplified for the sake of example.</p>
  
  <pre><code>// shopping.jsp
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@taglib prefix="t" tagdir="/WEB-INF/tags" %&gt;
  &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  
  &lt;t:standard_page&gt;
      &lt;jsp:body&gt;
          &lt;t:products product="${product}"/&gt;
      &lt;/jsp:body&gt;
  &lt;/t:standard_page&gt;
  
  
  // products.tag
  // I want to specify a css file in this tag file that will get added to the &lt;head&gt; element of the webpage
  &lt;%@tag description="Template for products on the shopping cart page" pageEncoding="UTF-8"%&gt;
  &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt;
  &lt;%@tag import="com.myapp.Product" %&gt;
  &lt;%@attribute name="product" required="true" type="com.myapp.Product"%&gt;
  
  &lt;div class="shopping-cart-row"&gt;
      &lt;div class="product-name"&gt;${product.name}&lt;/div&gt;
      &lt;div class="product-quantity"&gt;${product.quantity}&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>