title: Send and include JSP dynamically in another JSP
body: <p>I currently have a Jsp called menu-container that loads a base menu that should appear on each of my pages, but each page will add options to that menu, those options go in a specific place, so I would like to know how I can send the Content to the menu-container (which is a Jsp) from another, here is the menu-container:</p>
  
  <pre><code>&lt;ul id="menu"&gt;
   &lt;!-- Modificar las authorities segun la aplicacion --&gt;
   &lt;div class="navbar navbar-default menu"&gt;
    &lt;div class="navbar-header" &gt;
            &lt;button type="button" class="navbar-toggle collapsed"
               data-toggle="collapse" data-target="#menu-colapse" aria-
   expanded="false"
                aria-controls="navbar"&gt;
               &lt;span class="sr-only"&gt;Menú&lt;/span&gt; &lt;span class="icon-bar"&gt;
   &lt;/span&gt;
              &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt;
      &lt;/button&gt;
  &lt;/div&gt;
  
  &lt;!-- Menu colapse --&gt;
  &lt;div id="menu-colapse" class="navbar-collapse collapse"&gt;
  &lt;!-- Menu usuario - para opciones de control del usuario--&gt;
  &lt;ul class="nav navbar-nav navbar-right"&gt;
      &lt;li class="dropdown user-options"&gt;
          &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;
              &lt;i class="fa fa-cog"&gt;&lt;/i&gt;
              &lt;!--[if IE 7]&gt;
                  Opciones &lt;span class="caret"&gt;&lt;/span&gt;
              &lt;![endif]--&gt;
          &lt;/a&gt;
          &lt;!-- En este dropdown van las opciones que se necesiten en la aplicacion --&gt;
          &lt;ul class="dropdown-menu"&gt;
  
              &lt;!-- Nombre del usuario, recuperado por spring --&gt;
              &lt;li&gt;
                  &lt;a href="#" class="a-no-link"&gt;
                      &lt;!--[if !IE 7]&gt;&lt;!--&gt;
                          &lt;i class="fa fa-user fa-padding-6 fix-right-menu" aria-hidden="true"&gt;&lt;/i&gt;
                      &lt;!--&lt;![endif]--&gt;
                      &lt;sec:authentication property="principal" /&gt;
                  &lt;/a&gt;
              &lt;/li&gt;
  
              &lt;!-- Logout --&gt;
              &lt;li&gt;
                  &lt;div class="form-inline" style="color: white !important; height: 23px;"&gt;
                  &lt;!--[if !IE 7]&gt;&lt;!--&gt;
                              &lt;i class="fa fa-sign-out fa-padding-6" aria-hidden="true" style="margin-left: 16px;"&gt;&lt;/i&gt;
                          &lt;!--&lt;![endif]--&gt;
                  &lt;a  href="SalirAplicacion" style="color: white !important;"&gt;&lt;spring:message code="menuPpal.salir"/&gt;&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt; 
  &lt;ul class="nav navbar-nav navbar-right"&gt;
      &lt;li class="dropdown user-options"&gt;
          &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;
              &lt;i class="fa fa-language"&gt;&lt;/i&gt;
          &lt;/a&gt;
          &lt;ul class="dropdown-menu"&gt;
              &lt;li&gt;&lt;a class="a-link" href="configuracionInicio?idioma=en&amp;pagina=inicio" title="English"&gt;English&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a class="a-link" href="configuracionInicio?idioma=es&amp;pagina=inicio" title="Español"&gt;Español&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a class="a-link" href="configuracionInicio?idioma=fr&amp;pagina=inicio" title="Français"&gt;Français&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  &lt;!-- /Menu usuario --&gt;
  
  &lt;ul class="nav navbar-nav navbar-right" aria-expanded="false" id="main-menu"&gt;
  
  
      //This is the place for the Li Items 
      //One or more items to add
  
  
  &lt;/ul&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now the invoking Jsp has something like this:</p>
  
  <pre><code> &lt;jsp:include page="comun/menu-container.jsp" /&gt;
  </code></pre>
  
  <p>But as I must send it from the jsp that invokes the items (from which it invokes because it is in that they are distinguished from each other of course), but I do not know how to do it, suppose I put them in a new Jsp, that I call it and then How do I pass it to the container? And how do you receive it?</p>
  
  <p>Thanks for taking the time any help is welcome, regards!</p>
  
  <p>Pdta: what I want to avoid is having to have muuuchas classes menu that only change in what they add because it makes me very bad practice.</p>