页面src 超链接后跟action路径作为参数,同时action需要传参的处理方法

10 篇文章 0 订阅
页面<iframe src= 超链接后跟action路径作为参数,同时action需要传参时
多个问号?

http://127.0.0.1:8095/statics/js/viewer.html?file=/contractTemplateRepository/showpdf?filePath=ONE_DEV/697de26cf5b8411e9e6bb4a37e5e7fe5.pdf
执行不成功:可以获得filePath参数名称,但是值为空


方案1.
页面:http://127.0.0.1:8095/contractTemplateRepository/showpdf?filePath=ONE_DEV/697de26cf5b8411e9e6bb4a37e5e7fe5.pdf
URLEncode编码:为 
http%3A%2F%2Fxxxx.com%3A89%2Fdemo%2Ffileupdown%3Ffud%3D1%26rid%3D4%26iswe.pdf 
访问地址改成为: 
http://127.0.0.1:8095/statics/js/viewer.html?file=http%3A%2F%2Fxxxx.com%3A89%2Fdemo%2Ffileupdown%3Ffud%3D1%26rid%3D4%26isweb%3D1%26iswebshow%3D1%26dbid%3D01%26filepath%3Dfj_ob_item%2FY201809%2F11.pdf
 

action中,使用URLDecode解析,然后自行处理方案2.
调整为  
js中定义参数
var filePath=""
var iframeStr="<src='"+ path+"/statics/js/viewer.html?file=/contractTemplateRepository/showpdf?"+filePath+"'/>"
 后台action      使用request.getQueryString(); (getParam..都不好使) 直接获取到传入的字符串。。。
 如果需要多个参数,那么可以根据自己想法js中整理成一个字符串传递

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值