起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3017|回复: 3

[处理中3] 关于url中传入action参数的问题

[复制链接]

407

主题

926

帖子

2039

积分

金牌会员

Rank: 6Rank: 6

积分
2039
QQ
发表于 2020-7-27 08:34:38 | 显示全部楼层 |阅读模式
// 这个案例中为了下载时能给出文件名,自定义了一个.j用于执行下载的get请求,.j请参考"$UI/demo/actions/process/invokeAction/downloadFile.j"
        // 提交前需要进行URL转换,在URL上补足bsessionid等必要信息
        var url = require.toUrl("$UI/demo/actions/process/invokeAction/downloadFile.j?bsessionid=" + this.getContext().getBSessionID());
        // 用get方式传参
        url = url + "&process=" + this.getContext().getCurrentProcess() + "&activity=" + this.getContext().getCurrentActivity() + "&executor=" + this.getContext().getExecutor()
                + "&action=demoDownloadFile" + "&fileName=123.jpg";

        // + "&fileName=" + window.encodeURI($(downloadFileName).val());
        // 弹出下载
        window.open(url);

上面的正常,现在我将 $UI/demo/actions/process/invokeAction/downloadFile 中的内容复制一份为$UI/ERP/BID/Test/process/StaticTest/DD
配置编译路径后可以编译通过,正常使用,然后 创建一个动作和 demoDownloadFile 有相同的返回值excelStream ,
var url = require.toUrl("$UI/ERP/BID/Test/process/StaticTest/DD.j?bsessionid=" + this.getContext().getBSessionID());
        // 用get方式传参
        url = url + "&process=" + this.getContext().getCurrentProcess() + "&activity=" + this.getContext().getCurrentActivity() + "&executor=" + this.getContext().getExecutor()
               
                + "&action=excelStream" + "&fileName=excel.xls" ;
        // + "&fileName=" + window.encodeURI($(downloadFileName).val());
        // 弹出下载
        console.log(url);
        window.open(url);

然后报错:
2020-07-27 08:28:55 action:<?xml version="1.0" encoding="UTF-8"?>
<action process="/ERP/BID/Test/process/StaticTest/staticTestProcess" activity="mainActivity" name="excelStream" executor="" execute-context="" content-type="application/xml"><parameters><parameter name="fileName"><xbiz:simple xmlns:xbiz="http://www.justep.com/xbiz#" type="http://www.w3.org/2001/XMLSchema#String">excel.xls</xbiz:simple></parameter></parameters></action>
java.lang.IllegalArgumentException: wrong number of arguments
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.justep.system.action.Engine.invokeActions(Native Method)
    at com.justep.system.action.Engine.invokeActions(Unknown Source)
    at com.justep.business.server.BusinessServer.doAction(Unknown Source)
    at com.justep.business.server.BusinessServer.doExcute(Unknown Source)
    at com.justep.business.server.BusinessServer.excute(Unknown Source)
    at com.justep.business.server.BusinessServer.excute(Unknown Source)
    at com.justep.business.server.BusinessServerServlet.execService(Unknown Source)
    at com.justep.business.server.BusinessServerServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at com.justep.x.bs.BusinessServerServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.justep.micro.service.MicroServiceFilter.doFilter(Unknown Source)

action的动作的对应参数是怎么在这个url里面传给动作的?


91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35972
发表于 2020-7-27 09:46:05 | 显示全部楼层
报错的就是action的参数个数不正确,确认action的参数和设置的参数是否匹配
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

407

主题

926

帖子

2039

积分

金牌会员

Rank: 6Rank: 6

积分
2039
QQ
 楼主| 发表于 2020-7-27 14:19:53 | 显示全部楼层
jishuang 发表于 2020-7-27 09:46
报错的就是action的参数个数不正确,确认action的参数和设置的参数是否匹配

我其实想问的是,x5在解析这个的时候,process、activity、executor 应该不是动作的参数把,然后fileName可以作为动作的参数,但是往后面再加上其他的参数的时候,怎么确保,某些参数是加在action上的,应该不可能不进行区分就直接加把?是不是根据action.m中定义的参数名称进行判断后组合的?  : url = url + "&process=" + this.getContext().getCurrentProcess() + "&activity=" + this.getContext().getCurrentActivity() + "&executor=" + this.getContext().getExecutor()               
                + "&action=excelStream" + "&fileName=excel.xls" ;
回复 支持 反对

使用道具 举报

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
35972
发表于 2020-7-28 09:02:19 | 显示全部楼层
action中自己定义参数啊
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-6-26 13:53 , Processed in 0.082901 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表