0
点赞
收藏
分享

微信扫一扫

从jsp中将数组元素传递到servlet类中使用的方法

程序员漫画编程 2022-04-30 阅读 7
java
function deleteTips() {
    let flag = false;//用于标记是否选择了至少一个条目
    let url = 'paper?opr=deleteChosen&str=sep';//定义url的头部
    let tips = document.getElementsByName("tip");
    for (let tip of tips) {
        if (tip.checked) {
            url = url + tip.value + 'sep';//遍历数组,将数组类的元素拼接到url中,添加切割标记sep,方便在servlet类中进行处理
            flag = true;//有条目被选择后,将flag赋值true
        } else {
            continue;
        }
    }
    if (flag) {
        location.href = url;//将完整的url作为跳转地址
    } else {
        alert("至少选择一条记录");
        return;
    }


}
举报

相关推荐

0 条评论