title: AJAX call to struts action not working
body: <p>Hi i have a requirement in which i have to check something from struts action class and then send the result back to the browser using ajax call called in a JS fx'.The issue is im not able to hit the action class and console is throwing the following error:
  <strong>org.apache.struts.action.RequestProcessor processActionCreate No action instance for path /ChangePwdAjax could be created
                                   java.lang.ClassNotFoundException:test.ChangePwdAjaxAction.java</strong></p>
  
  <p>The class is compiled and the package context is valid test.ChangePwdAjaxAction.java</p>
  
  <p>Any ideas what and where im doing it wrong?</p>
  
  <p>Here is what i have written so far.</p>
  
  <p>JS code</p>
  
  <pre><code>function checkError()
  {
  var valuePassword="test";
  
  var url = "/test/ChangePwdAjax.do?newPass="+valuePassword;
          var xmlHTTP = getXMLHTTPRequest();
  
  
          xmlHTTP.onreadystatechange = function() { 
          handleResponse(xmlHTTP); }
  
          xmlHTTP.open("GET",url,true);
  
          xmlHTTP.send();
  
  
  }
  
  function handleResponse(xmlHTTP){
      alert("handleResponse");
          if (xmlHTTP.readyState == 4 &amp;&amp; xmlHTTP.status == 200) {
              alert("handleResponse");
              var xmlDoc = xmlHTTP.responseXML;
  
              alert(xmlDoc.documentElement.getElementsByTagName("pwdFlag")[0].text);
  
          }       
      }
  
  function getXMLHTTPRequest(){
      alert("getXMLHTTPRequest");
          if (window.XMLHttpRequest) {
              return new XMLHttpRequest();
          }
          // IE
          else if (window.ActiveXObject) {
              return new ActiveXObject("Microsoft.XMLHTTP");
          }
          else{
          alert("XMLHttpRequest is not supported!");
          }
      }
  </code></pre>
  
  <p>Action class code</p>
  
  <pre><code>public class ChangePwdAjaxAction extends Action {
  
  
      public ActionForward execute(final ActionMapping mapping, final ActionForm form,
              final HttpServletRequest request,final HttpServletResponse response)
  
      {
  
          System.out.println("----IN--AJAX ACTION----------");
          final HttpSession session= request.getSession(false);
  
          if(session==null || session.getAttribute("user_id")==null){
  
              return mapping.findForward("sessionexpired");
          }
  
  
          final String user_id=(String)session.getAttribute("user_id");
  
          try{
  
  
              final BusinessDelegate busdel=new BusinessDelegate(user_id,session.getId());
  
              String newpwd = (String)request.getParameter("newPass");
  
  
  
              boolean b=busdel.checkOldPWd(user_id, newpwd);
              //checking return values from bus delegate
              response.setContentType("text/xml");
              PrintWriter printwriter = response.getWriter();
  
              printwriter.println("&lt;?xml version=\"1.0\"?&gt;");
              printwriter.println("&lt;Root&gt;");
  
              if(b)
              {
                  System.err.println("----New password Failed--Y--------");   
              printwriter.println("&lt;pwdFlag&gt;"+"Y"+"&lt;/pwdFlag&gt;");
              }
              else
              {
                  System.out.println("----New password OK---N-------");   
                  printwriter.println("&lt;pwdFlag&gt;"+"N"+"&lt;/pwdFlag&gt;");
              }
  
  
              printwriter.println("&lt;/Root&gt;");
  
  
              }catch(Exception e){
                  logger.logCommon("Login Action : Login Process in Action : ", "EXCEPTION");
                  logger.logError(e);
  
              }
  
  
          return null;
      }
  
  
  }
  </code></pre>
  
  <p>Struts-config entry</p>
  
  <pre><code>&lt;action path="/ChangePwdAjax" type="test.ChangePwdAjaxAction.java"/&gt;
  </code></pre>