我是not using struts2-jquery-plugin
。只使用struts2-json-plugin with JQuery
最新的。
验证成功后想redirect/actionredirect
转到另一个页面。如果我这样做,<result type="redirect">/quiz-success.jsp</result>
或者<result>/quiz-success.jsp</result>
不工作。
问题:你们是怎么做到的?
1 - Is it possible to do redirection etc in struts.xml during AJAX request?
2 - I have to redirect/page refresh in $.ajax({ success: function (data) {} }); like below?
$.ajax({
url: url,
type: 'POST',
data: viewData,
//dataType: "json",
cache: false,
complete: postValidation,
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("error :"+XMLHttpRequest.responseText);
},
success: function (data) {
Window.location = "/cms/home.action"+sessiontoken;
}
});
struts.xml
<package name="validation" namespace="/validation" extends="json-default">
<action name="quizAjax" class="com.myapp.action.QuizAction" method="sayHi">
<interceptor-ref name="jsonValidationWorkflowStack"/>
<result name="input">/quiz-ajax.jsp</result>
<result type="redirect">/quiz-success.jsp</result>
</action>
</package>