title: include external java script file in jsp page
body: <p>I have an external JavaScript file named paging.js. Following are the contents of the file:</p>
  
  <pre><code>function Pager(tableName,itemPerPage){
      this.tableName = tableName;
      this.itemPerPage = itemPerPage;
      this.currentPage = 1;
      this.pages = 0;
  
      this.init()= function(){
          alert("init called ");
          var rows = document.getElementById(tableName).rows;
          var records = (rows.length - 1);
          this.pages = Math.ceil(records / itemPerPage);
      }
  
      this.showPageNav = function(pagerName,positionId){
          alert("show page navi call");
          var element = document.getElementById(positionId);
          var pagerHtml = '&lt;input src = "next.jpg" type="image"&gt;';
          pagerHtml += '&lt;input src = "next.jpg" type="image"&gt;' ;
          element.innerHTML = pagerHtml;
      }
  }
  </code></pre>
  
  <p>Now I tried to call init from my jsp page like . </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
                          var pager = new Pager('results',7);
                          pager.init();
                      &lt;/script&gt;
  </code></pre>
  
  <p>This code i put before complete my body part in my jsp page.</p>
  
  <p>For including this page I put line like </p>
  
  <pre><code>&lt;script type="text/javascript" 
                    src="${pageContext.request.contextPath}/js/paging.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>But i can't able to call init method. Is there anyone to help me for finding problem?</p>