ActionError not getting displayed

Viewed 1224

I want to load my Error.jsp in my ErrorDiv if Action class returns error. I am doing an AJAX call.

JS:

success: function(result){    
    if(result === 'success')
        alert('Database Updated Successfully!');
    else{
         $('#ErrorDiv').load('/gma/pages/Error.jsp');
    }
}

                

Error.jsp:

<body>

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<s:if test="hasActionErrors()">
       <s:actionerror />
</s:if>

</body>

However, action errors are not getting displayed. In firebug I checked, response to GET Error.jsp in that the <body> </body> part comes empty.

Why are actionError not getting displayed?

EDIT:

Action Class:

try{
slsConfigureTspThresholdRemote.setThresholdParameters(circleId, tspId, thresholdTypeFlag, thresholdParametersList);

}
catch (Exception e){    
    addActionError(e.getMessage());
    e.printStackTrace();
    
    result = "error";
    return ERROR;
}

struts.xml:

<action name="updateThresholdParameters"
class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction" method="updateThresholdParameters">

<result name="success" type="json">
    <param name="root">result</param>
</result> 

<result name="error">pages/Error.jsp</result>

Presently, I am doing $('#ErrorDiv').html(result); so that my JSP get loaded in div instead of

$('#ErrorDiv').load('/gma/pages/Error.jsp');!
1 Answers
Related