title: Forwarding using mapping.findForward in Struts 1.2
body: <pre><code>public class MyAction extends Action
  {   
      public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {
  
          String status="success";
          HttpSession session = request.getSession(true);
          System.out.println("My Action---setting key value");
          request.getSession().setAttribute("key1","check");
  
          //response.sendRedirect("http://localhost:9080/FamiliarPortal/jsp/inicio.jsp");
          return mapping.findForward(status); 
  
      }
  }
  </code></pre>
  
  <p>In <code>Struts-config.xml</code>, the following is added:</p>
  
  <pre><code>&lt;action path="/myAction" type="iusa.ubicacel.actions.MyAction" validate="false" &gt;
           &lt;forward name="success" path="/jsp/inicio.jsp"/&gt;       
  &lt;/action&gt;
  </code></pre>
  
  <p>In <code>web.xml</code>, the following is added:</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;servlet-name&gt;GetFAP&lt;/servlet-name&gt;
          &lt;servlet-class&gt;iusa.ubicacel.actions.map.GetFAP&lt;/servlet-class&gt;
      &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;action&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;GetFAP&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/GetFAP&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>In <code>inicio.jsp</code>, the following is added:</p>
  
  <pre><code>&lt;BODY onload="requestXML('&lt;%=reqURL %&gt;');"&gt;
  
  &lt;table border="0" cellspacing="0" cellpadding="0" align="center"&gt;
      &lt;tr&gt;
          &lt;td align="center" valign="middle"&gt;
              &lt;div id="mapdiv" style="width: 1000px; height:700px"&gt;&lt;/div&gt; 
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/BODY&gt;
  </code></pre>
  
  <p>The function <code>requestXML</code> is as follows:</p>
  
  <pre><code>function requestXML(reqURL) 
  {   
      alert("calling requestXML"+reqURL);
      var url = "../GetFAP?requestURL=" + reqURL;
      alert("calling requestXML"+url);
      xmlhttpUbi = FAPXMLHttpRequest();
      xmlhttpUbi.open("POST", url, true); // async
      alert("after calling");
      xmlhttpUbi.onreadystatechange = obtainFAPLocation;
      xmlhttpUbi.send(null);
  }
  </code></pre>
  
  <p>The above code is not calling the GetFAP servlet when using <code>mapping.findForward</code>. But when I used <code>response.sendRedirect("entire jsp path")</code> it is calling the servlet.</p>
  
  <p>Can anyone tell me what I am doing wrong here?</p>