系统对接要接入别的系统,需要自动登录进去

设计一个中转页:自动JavaScript触发表单提交即可

    /**
     * 跳转Datastudio
     * @param request request
     * @return ModelAndView
     */
    @RequestMapping("gotoDatastudio")
    public ModelAndView gotoDatastudio(HttpServletRequest request) {
        ModelAndView view = new ModelAndView("bdm/gotoDatastudio");
        String workflowUrl = configRemoteService.getByKey("big.data.studio.login.url", "http://datastudio.chinamuseum.cn:31479/login");
        workflowUrl +="?login_url="+request.getParameter("login_url");
        String username = configRemoteService.getByKey("big.data.studio.login.username", "admin");
        String password = configRemoteService.getByKey("big.data.studio.login.password", "admin");
        view.addObject("workflowUrl", workflowUrl);
        view.addObject("username", username);
        view.addObject("password", password);
        return view;
    }

HTML中转页

<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" style="overflow: hidden;height: 100%;">
<!--/* 加载IE8兼容性片段 */-->
<head>
    <title text="平台"></title>
</head>
<body>
<div id="app">
    <div>
        加载中...
    </div>
    <form method="post" th:action="${workflowUrl}" id="submitClick"  style="display: none">
        <input type="text" name="username" th:value="${username}"/>
        <input type="password" name="password" th:value="${password}"/>
        <button type="submit">Submit</button>
    </form>
</div>
<div id="scripts">
    <script th:inline="javascript">
        $(function () {
            setTimeout(function(){
                document.getElementById("submitClick").submit();
            }, 1000);
        });
    </script>

</div>
</body>
</html>

这样延迟1秒后自动提交表单--登录第三方系统

posted on   白嫖老郭  阅读(39)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示