jquery from的ajaxsubmit方法,调用servlet成功后,能够执行回调函数,但是调用struts2的action后不行
我的struts2配置文件如下:<struts><constantname="struts.devMode"value="true"></constant><consta...
我的struts2配置文件如下:
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
<constant name="struts.custom.i18n.resources" value="globalMessages"/>
<package name="oa-default" namespace="/" extends="struts-default">
<action name="*_*_*" method="{3}"
class="com.tydic.mis.app.{1}.web.action.{2}Action">
<result name="jsp">/jsp/${targetUrl}.jsp</result>
<result name="forwardAction" type="redirect">/${targetUrl}.action</result>
<!-- <result name="json" type="json"></result>-->
<result name="generateExcel" type="stream">
<param name="contentType">application/octet-stream</param>
<param name="inputName">downloadFile</param>
<param name="contentDisposition">attachment;filename="${fileName}"</param>
<param name="bufferSize">4096</param>
</result>
</action>
</package>
</struts>
html代码:
<%@ page contentType="text/html; charset=utf-8"%>
<%@ page language="java" pageEncoding="utf-8"%>
<html>
<head>
<script type = "text/javascript" src = "/mis/js/jquery/jquery.js"></script>
<script type = "text/javascript" src = "/mis/js/jquery/jquery.form.js"></script>
<script type="text/javascript">
function doSubmit()
{
var options = {
// post-submit callback
target:'#Tip',
url:'common_general.Admin_insertAdmin.action',
type:'post',
dataType:'text',
clearForm: true,
resetForm: true,
success: showResponse //显示操作提示
};
$('#myform').submit(function() {
$('#myform').ajaxSubmit(options);
});
}
function showResponse(responseText, statusText) {
alert("回调"+responseText);
}
</script>
</head>
<body> <span id="Tip"></span>
<form action="" id="myform" name="myform" method="post" onsubmit="return doSubmit(this);">
<input type="text" id="test" value="111">
<input type="submit" value="submit">
</form>
</body>
</html>
希望高手能够指点,不胜感激! 展开
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
<constant name="struts.custom.i18n.resources" value="globalMessages"/>
<package name="oa-default" namespace="/" extends="struts-default">
<action name="*_*_*" method="{3}"
class="com.tydic.mis.app.{1}.web.action.{2}Action">
<result name="jsp">/jsp/${targetUrl}.jsp</result>
<result name="forwardAction" type="redirect">/${targetUrl}.action</result>
<!-- <result name="json" type="json"></result>-->
<result name="generateExcel" type="stream">
<param name="contentType">application/octet-stream</param>
<param name="inputName">downloadFile</param>
<param name="contentDisposition">attachment;filename="${fileName}"</param>
<param name="bufferSize">4096</param>
</result>
</action>
</package>
</struts>
html代码:
<%@ page contentType="text/html; charset=utf-8"%>
<%@ page language="java" pageEncoding="utf-8"%>
<html>
<head>
<script type = "text/javascript" src = "/mis/js/jquery/jquery.js"></script>
<script type = "text/javascript" src = "/mis/js/jquery/jquery.form.js"></script>
<script type="text/javascript">
function doSubmit()
{
var options = {
// post-submit callback
target:'#Tip',
url:'common_general.Admin_insertAdmin.action',
type:'post',
dataType:'text',
clearForm: true,
resetForm: true,
success: showResponse //显示操作提示
};
$('#myform').submit(function() {
$('#myform').ajaxSubmit(options);
});
}
function showResponse(responseText, statusText) {
alert("回调"+responseText);
}
</script>
</head>
<body> <span id="Tip"></span>
<form action="" id="myform" name="myform" method="post" onsubmit="return doSubmit(this);">
<input type="text" id="test" value="111">
<input type="submit" value="submit">
</form>
</body>
</html>
希望高手能够指点,不胜感激! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询