title: How to change the class of an element in a JSP from the controller?
body: <p>I am trying to set the class of a list element (placed in a header file) according to the page I am on. The header file is imported into every page. </p>
  
  <p>This project is using the Spring framework. I am new to Java Servlets and I am used to doing this in .NET in a straightforward way. I want to know what the most appropriate way to do it in Java/JSP is.</p>
  
  <p>This is the header page (header.jsp):</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;title&gt;My Project&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="mainHeaderDiv" class="header main"&gt;
              &lt;div class="header_resize"&gt;
                  &lt;div class="clr"&gt;&lt;/div&gt;
                  &lt;div class="menu_nav"&gt;
                      &lt;ul&gt;
                          &lt;li id="liHome"&gt;&lt;a href="./Home.htm"&gt;Home&lt;/a&gt;&lt;/li&gt;
                          &lt;li id="liOrderInfo"&gt;&lt;a href='./OrderInfo.htm'&gt;&lt;span&gt;Delivery Info&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li id="liInvoice"&gt;&lt;a href='./Invoice.htm'&gt;&lt;span&gt;Invoice Info&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li id="liShipment"&gt;&lt;a href='./Shipment.htm'&gt;&lt;span&gt;Sales Order Info&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li id="liMaterial"&gt;&lt;a href='./Material.htm'&gt;&lt;span&gt;Material Info&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li id="liLogout"&gt;&lt;a href="./logout.htm"&gt;Logout&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
                  &lt;div class="clr"&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>One of the pages I am importing the above header into (home.jsp):</p>
  
  <pre><code>&lt;%@include file="./header.jsp" %&gt;
  &lt;div &gt;
          &lt;div class="content"&gt;
              &lt;div class="content_resize"&gt;
                  &lt;div class="clr"&gt;&lt;/div&gt;
                  &lt;div&gt;
                      &lt;div class="article"&gt;
                      &lt;c:if test="${companyInfo != null}"&gt;
                          &lt;h2&gt;
                              &lt;span&gt;Company Profile&lt;/span&gt;
                          &lt;/h2&gt;
                          &lt;b&gt; &lt;u&gt;Company Information&lt;/u&gt;
                          &lt;/b&gt;
                          &lt;table&gt;
                              &lt;tr&gt;
                                  &lt;td&gt;&lt;/td&gt;
                              &lt;/tr&gt;
                      &lt;/table&gt;
                   &lt;/c:if&gt;
                      &lt;div class="clr"&gt;&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;              
          &lt;/div&gt;          
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The controller method:</p>
  
  <pre><code>@RequestMapping(value = "/Home", method = RequestMethod.GET)
  public String home(@ModelAttribute("user") User user, Model model) {
      logger.debug("BEGIN");
      /*
      .
      .
      .
      */
      logger.debug("END");
      return "Home";
  }
  </code></pre>
  
  <p>(Stripped out scripts and imports to make reading the actual code easier.)</p>
  
  <p>So when I am on the home page, which is the best way to highlight the 'Home' menu option, if at all possible?</p>