title: How to load JSP page on next/prev click of Bootstrap carousel
body: <p>Earlier I had scrollbar, where different icons were displayed. on click of particular icon, jsp page was displayed. but i need to replaced it with carousel.</p>
  
  <p>on next/prev click following function should be called:</p>
  
  <pre><code> function testing(index) {
          var tableLength = tableAddArray.length;
          for (var i = 0; i &lt; tableLength; i++) {  
              if (i == index) {
                  selectedElement= tableAddArray[i].id;
              }
              console.log("selectedElement:: "+selectedElement);
          }
          createElement();
      }
  
  
  function createElement() {
      var request ="/xyzz/abcdd?objectName="; 
      var attributesToSend = "&amp;action=add" ; 
      attributesToSend += "&amp;ref="+document.getElementsByName("ref")[0].value ; 
      document.getElementsByName("action")[0].value = "add"; 
      if (selectedElement != null) { request += selectedElement; 
      if (selectedElement == "1") {equest += "&amp;condOp=5"; } 
      else if (selectedElement == "2") {request += "&amp;dest=2";} 
      request += attributesToSend; location.href=request; 
      //from here other processing is done to get corresponding data from DB 
      } 
  } 
  </code></pre>
  
  <p>then in carousel,: </p>
  
  <pre><code>    &lt;div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="false"&gt; 
      &lt;div class="carousel-inner"&gt; 
      &lt;div class="carousel-item"&gt; 
      &lt;c:choose&gt; 
      &lt;c:when test="${requestScope.objectName == '2'}"&gt; 
      &lt;jsp:include page="2nd_Slide.jsp"&gt;&lt;/jsp:include&gt; &lt;/c:when&gt;
       &lt;c:when test="${requestScope.objectName == '3'}"&gt; 
      &lt;jsp:include page="3rd_slide.jsp"&gt;&lt;/jsp:include&gt; &lt;/c:when&gt; 
      &lt;/c:choose&gt;
       &lt;/div&gt; 
       &lt;a class="carousel-control-prev" ..&gt; 
      &lt;a class="carousel-control-next" ..&gt; 
      &lt;/div&gt; 
  </code></pre>
  
  <p>Hence i need to set objectname at 0th index as well. I dont know how to call js before 0th slide of carousel is shown.</p>