获取404找不到针对Struts的Ajax发布请求的HTTP状态

时间:2019-01-17 07:50:13

标签: javascript java jquery ajax struts

我试图将Ajax发布请求发送到struts(1.x)Action。但是我总是无法找到HTTP 404状态。

这是我的ajax代码

function autoSave(){
        //alert('clled auto save function');
        console.log('Time duration check');
        var form = document.initPetitionerWizardForm;
        $.ajax({
            url: 'LoadPetitionerWizardPage1.do',
            dataType: 'json',
            type: 'post',
            contentType: 'application/json',
            data:$(form).serialize(),

            success: function( ){
                console.log('success');
            },
            error: function( ){
                console.log( 'something wrong');
            }
        });

        //e.preventDefault();
    }
    $(document).ready(function(){
         setInterval(autoSave,5000);
    });
  

这是我的struts配置xml

       <action path="/loadPetitionerWizardPage1"
            name="initPetitionerWizardForm"
            type="web.clerk.webapp.oop.action.LoadPetitionerWizardPage1Action">
        <forward name="FAILURE" path="/Home.jsp" contextRelative="false"/>
        <forward name="SUCCESS" path="/PetitionerWizard1.jsp" contextRelative="false"/>
    </action>
  

这是我的动作课

public class LoadPetitionerWizardPage1Action extends Action {

String LEAGAL_AGENCY = "legal.agency.";
String AGENCY_NAME = "name";
String AGENCY_NUMBERS = "numbers";
String AGENCY_WEB_URL_NAME = "urlname";
String AGENCY_WEB_URL = "url";

public ActionForward execute(ActionMapping mapping, ActionForm form,
                             HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    LoggerUtils.info("Inside " + this.getClass().getName()
            + " --> execute method --> Exit ");
    return actionForward;

}// end of method - execute

}

0 个答案:

没有答案
相关问题