程序代码如下:
function deleteArticle(seriId){
alert(seriId);
if(confirm("是否删除文章!")){
window.location.href ="delete.do?moduleId=${module.id}&seriId="+seriId;
}
}
用alert能够打印出seriId 但是请求时作为值传递时不能传入后续的Action中 这是什么原因?
增加一句调试语句
alert("delete.do?moduleId=${module.id}&seriId="+seriId );
看看这个URL是否正确,如果正确的话,将参数seriId的值修改一下,比如修改成23
"delete.do?moduleId=${module.id}&seriId="+23,
再看Action中能否正确取值,如果可以就是参数值的问题;如果不行,再修改成这样试试
"delete.do?moduleId=${module.id}&seriId=23"。
看看Action中有没有漏掉对应的get/set方法
后台是用哪个方法获取参数的?
delete.do的路径是不是正确的?要不写死
<%=path%>/delete.do
window.location.href ="delete.do?moduleId=${module.id}?seriId="+seriId;
试试这行代码行不行
....当然没用。
window.location.href ="delete.do?moduleId=${module.id}&seriId="+encodeURIComponent(seriId);