页面<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编码:为 https%3A%2F%2F2.zoppoz.workers.dev%3A443%2Fhttp%2Fxxxx.com%3A89%2Fdemo%2Ffileupdown%3Ffud%3D1%26rid%3D4%26iswe.pdf 访问地址改成为: http://127.0.0.1:8095/statics/js/viewer.html?file=https%3A%2F%2F2.zoppoz.workers.dev%3A443%2Fhttp%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中整理成一个字符串传递