for server side validation i use json response on aftersubmit event as shown below
navGrid("#pager2",{}, //options
{height:280,width:700,reloadAfterSubmit:false}, // edit options
{height:280,width:700,reloadAfterSubmit:false,
afterSubmit : function(response, postdata) {
var msg = "noError";
var res = $.parseJSON(response.responseText);
if (res && res.userMessage) {
alert(res.userMessage);
msg = res.userMessage;
}
//alert(msg);
if(msg == "noError") {
return [true, "Validation pass"];
} else {
return [false, msg];
}
}}, // add options
{reloadAfterSubmit:false}, // del options
{} // search options
);
and the struts entry
<action name="jsontableEditValidationApartmentResource" class="com.loa.monitor.action.JsonActionResource" method="editValidate" >
<result name="success" type = "json"></result>
<result name="error" type="redirectAction">
<param name="actionName">proceedApartment</param>
</result>
</action>
and action method
public String editValidate() {
userMessage = "test msg1";
return "success";
}
private String userMessage ;
public String getUserMessage() {
return userMessage;
}
public void setUserMessage(String userMessage) {
this.userMessage = userMessage;
}
Let me know if this is useful