i am trying to make an ajax call but the error 404 is always appearing and that indicates that the action path is incorrect
here is the code i wrote:
struts-config.xml:
<action attribute="dataImportForm" parameter="action" name="dataImportForm" validate="true" path="/dataImport" scope="request" type="com.struts.action.dataImport.DataImportAction">
<forward name="success" path="/listDetails.jsp" contextRelative="true" />
<forward name="successList" path="/listDetails.jsp" contextRelative="true" />
</action>
<action parameter="do" path="/tempPlans" type="com.struts.action.dataImport.TempPlansAction">
<forward name="success" path="/listDetails.jsp" contextRelative="true" />
<forward name="successList" path="/detailsTable.jsp" contextRelative="true" />
</action>
JSP page where i'm writing the ajax call:
var xmlhttp_loadDetails;
function loadDetails(action,sort,direction,offset) {
alert("loadDeatials");
var url="../dataImport.do?action=load&a="+Date();
alert(url);
if(window.XMLHttpRequest)
{
xmlhttp_loadDetails=new XMLHttpRequest();
}
else
{
if(window.ActiveXObject)//for ie
{
xmlhttp_loadDetails=new ActiveXObject("Msxml2.XMLHTTP");
}
}
xmlhttp_loadDetails.onreadystatechange=state_Change_loadDetails;
xmlhttp_loadDetails.open("GET",url,true);
xmlhttp_loadDetails.send(null);
}
function state_Change_loadDetails()
{
// if xmlhttp shows "loaded"
statusBox = document.getElementById("listDetails")
if (xmlhttp_loadDetails.readyState==4)
{
// if "OK"
alert("xmlhttp_loadDetails.status: "+xmlhttp_loadDetails.status);
if (xmlhttp_loadDetails.status==200)
{
statusBox.innerHTML = xmlhttp_loadDetails.responseText
}
else
{
statusBox.innerHTML = "Problem retrieving XML data:" + xmlhttp_loadDetails.statusText
}
}
here is the code i wrote:
struts-config.xml:
<action attribute="dataImportForm" parameter="action" name="dataImportForm" validate="true" path="/dataImport" scope="request" type="com.struts.action.dataImport.DataImportAction">
<forward name="success" path="/listDetails.jsp" contextRelative="true" />
<forward name="successList" path="/listDetails.jsp" contextRelative="true" />
</action>
<action parameter="do" path="/tempPlans" type="com.struts.action.dataImport.TempPlansAction">
<forward name="success" path="/listDetails.jsp" contextRelative="true" />
<forward name="successList" path="/detailsTable.jsp" contextRelative="true" />
</action>
JSP page where i'm writing the ajax call:
var xmlhttp_loadDetails;
function loadDetails(action,sort,direction,offset) {
alert("loadDeatials");
var url="../dataImport.do?action=load&a="+Date();
alert(url);
if(window.XMLHttpRequest)
{
xmlhttp_loadDetails=new XMLHttpRequest();
}
else
{
if(window.ActiveXObject)//for ie
{
xmlhttp_loadDetails=new ActiveXObject("Msxml2.XMLHTTP");
}
}
xmlhttp_loadDetails.onreadystatechange=state_Change_loadDetails;
xmlhttp_loadDetails.open("GET",url,true);
xmlhttp_loadDetails.send(null);
}
function state_Change_loadDetails()
{
// if xmlhttp shows "loaded"
statusBox = document.getElementById("listDetails")
if (xmlhttp_loadDetails.readyState==4)
{
// if "OK"
alert("xmlhttp_loadDetails.status: "+xmlhttp_loadDetails.status);
if (xmlhttp_loadDetails.status==200)
{
statusBox.innerHTML = xmlhttp_loadDetails.responseText
}
else
{
statusBox.innerHTML = "Problem retrieving XML data:" + xmlhttp_loadDetails.statusText
}
}