formSubmit(url,sTarget);的使用

一、formSubmit函数代码

function formSubmit(url, sTarget) {
//        alert(1)
        document.forms[0].target = sTarget
        document.forms[0].action = url;
        document.forms[0].submit();
        return true;
    }
url是要请求的路径,sTarget是源路径

二、实例:

点击导出按钮后即触发formSubmit(‘exportUserExcelPlus’,’_self’)函数,
<button class="btn btn-info " type="button" id="export" onclick="formSubmit('exportUserExcelPlus','_self');this.blur();"><i class="fa fa-cloud-download"></i>导出</button>
_self代表当前页面所处路径,exportUserExcelPlus即要请求的路径,注意,它会自动在源路径的基础上拼接要请求的路径。
源路径为 :http://localhost:8081/user/userManage

这里写图片描述

点击导出按钮后:http://localhost:8081/user/exportUserExcelPlus

这里写图片描述

三、需要注意的:

jsp页面上是否有form标签只会影响有无参数的传递,并不影响能否请求指定路径,并不影响对指定路径的请求。
没加form标签前:(请求为post类型)

这里写图片描述

加了form标签后:(请求为get类型,且有参数的传递)

这里写图片描述

四、写在最后:

Knowing your goals will increase your motivation.Once you konw where you want to go,start breaking your long-term goals down to manageable daily actions that are process-focused.Settting daily action-packed goals will help you stay focused on what you can do to ensure your long-term results come true~~~
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值