关于s-HR中url请求中参数获取问题原创
金蝶云社区-杨天罡
杨天罡
3人赞赏了该文章 218次浏览 未经作者许可,禁止转载编辑于2023年08月15日 11:19:49

二开在url中直接追加参数&xxx=xxx01,在后端通过

String xxx = request.getParameter("xxx");

发现无法获取到参数值,此时可以进行兼容处理下,从request的attribute获取:

Map customParams = (Map) request.getAttribute(Constants.CUSTOM_PARAMS);
String xxx = (String)customParams.get("xxx");

从请求中获取进行转换

String custom_params = request.getParameter(Constants.CUSTOM_PARAMS);
if (!StringUtils.isEmpty(custom_params)) {
    Map customParams = JSONUtils.convertJsonToObject(SHRContext.getInstance().getContext(),custom_params);
    request.setAttribute(Constants.CUSTOM_PARAMS, customParams);
    String xxx = (String)customParams.get("xxx");
}
//其中  Constants 为:com.kingdee.shr.base.syssetting.web.dynamic.util.Constants
赞 3