为什么location.href="xxx.action"不能跳转struts.xml里的action呢?

为什么location.href="xxx.action"不能跳转struts.xml里的action呢?,第1张

这个情况为什么要用locationhref ? 我想你的本意应该是 一堆列表记录中,每一条后面都有删除这个按钮吧?用ajax做啊。 strutsxml里面不用配置result跳转。
if(flag){
$post('xxxxactionid='+id,function(){
//删除成功后重新加载列表

})
}
-------------------Ps:如果你嫌ajax这种方式改动比较大,还有种简便的方式。在页面中写一个隐藏层,<div style="display:none"><form action="删除的url"><input type="text" id="delId"></form></div>;
然后在function中删除时,先给这个 input 框id="delId"赋值,再用js提交删除表单也是可以的

你得你的项目的访问路径名称,有的项目是无路径访问,即直接h t t p://ip:端口号/addaction,有的项目带路径发布,h t t p://ip:端口号/路径/addaction,所以你第一步得知道这个。
假如你的项目路径叫test,你在html中a标签就写href="/test/addactionid=1"
亲,这么辛苦的回答,记得采纳哦!

href="actionLoginactionuserid=documentgetElementByName('userId')value&userPassword=documentgetELement
纯靠记忆手写,思路已经阐明,有问题请追问。

我感觉要处理form里传的数据可以改写 form ,格式如下:
target="_blank" 这一句就是在新窗口打开
<form action="1asp" method="post" name="form1" target="_blank">
二次回答:
这样你看可以不
<script language="javascript">
<!--
function ok(rURL)
{
documentform1action = rURL;
documentform1target=="_blank";
documentform1submit();
}
//-->
</script>

<form name="form1" method="post">
<input type="button" value="OK1" name="OK1" onClick="ok('URL1html');">
<input type="button" value="OK2" name="OK2" onClick="ok('URL2html');">
</form>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/12666435.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-27
下一篇 2023-05-27

发表评论

登录后才能评论

评论列表(0条)

保存