title: Forwarding different page in jsp
body: <p>I have a index.jsp in my project and I want to forward the different page depends on the condition. The following is my code :</p>
  
  <pre><code>  $.ajax({url: "some_url",
          type: "HEAD",
          timeout:1000,
          statusCode: {
              200: function (response) {
                  callOnlinePage();
              },
              400: function (response) {
                  callOfflinePage();
              },
              0: function (response) {
                  callOfflinePage();
              }              
          }
      });
  
      function callOnlinePage(){
          &lt;jsp:forward page="online.jsp"/&gt;
      }
  
      function callOfflinePage(){
          &lt;jsp:forward page="offline.jsp"/&gt;
      }
  </code></pre>
  
  <p>javascript code is correct if I alert without putting jsp:forward tag. If I put them, it always go to online.jsp. If I put callOfflinePage function first, it forward to offline.jsp everytimes.</p>
  
  <p>So, is there anyway I can do without changing the url. Please...</p>