zoukankan      html  css  js  c++  java
  • 返回 字符串的 form和js组合让页面跳转

            router.get("/wy/jhy").handler(ctx->{
                ctx.request().response().setChunked(true);
                System.out.println("到此..........................................................................");
    
                ctx.request().params().names().stream().forEach(name->{
                    System.out.println("******************************************-:-"+name);
                });
                System.out.println(ctx.request().getParam("merOrderId"));
    
                String merOrderId = ctx.request().getParam("merOrderId");
                String last = merOrderId.substring(5);
                String tenantOrderNo = last.substring(0, last.length() - 19);
                String tenantId = last.substring(tenantOrderNo.length());
    
                JsonObject toDBRead = new JsonObject();
                toDBRead.put("read_or_write", "read");
                toDBRead.put("sql", MybatisNamespace.orders_getSy);
    
                JsonObject params = new JsonObject();
                params.put("tenantId",tenantId);
                params.put("tenantOrderNo",tenantOrderNo);
    
                toDBRead.put("params", params.toString());
    
                vertx.eventBus().<String>send(DB_CENTER_ADDRESS, toDBRead.toString(), new DeliveryOptions().setSendTimeout(60000), result -> {
                    if (result.succeeded()) {
    
                        System.out.println("=== : "+result.result().body());
    
                        String amount = ctx.request().getParam("amount");
                        StringBuilder sb = new StringBuilder(amount);
                        sb.insert(amount.length() - 2, ".");
    
                        String form = "<form id="returnForm" action=""+result.result().body()+"" method="get">
    " +
                                "<input type="hidden" name="amount" value=""+sb.toString()+""/>
    " +
                                "<input type="hidden" name="tenantId" value=""+tenantId+""/>
    " +
                                "<input type="hidden" name="tenantOrderNo" value=""+tenantOrderNo+""/>
    " +
                                "</form>
    " +
                                "<script>document.getElementById("returnForm").submit();</script>";
                        ctx.request().response().putHeader("Content-Type","text/html;charset=utf-8");
                        ctx.request().response().setStatusCode(200).write(form).end();
                    } else {
                        ctx.request().response().putHeader("Content-Type","text/html;charset=utf-8");
                        ctx.request().response().setStatusCode(200).end("内部错误");
                    }
                });
    
            });
    <form id="returnForm" action="http://www.baidu.com" method="get">
    <input type="hidden" name="amount" value="11.00"/>
    <input type="hidden" name="tenantId" value="4778638114955493397"/>
    <input type="hidden" name="tenantOrderNo" value="6CGeIhuL0apDX0aO03Ntd6lT"/>
    </form>
    <script>document.getElementById("returnForm").submit();</script>

    vertx 代码示例

  • 相关阅读:
    android手机开发网
    Android 使用Google Weather制作天气预报程序
    android反编译xml文件
    在线MSDN
    工作的思考一:业务流和工作管理
    .NET Remoting技术文章汇总
    学习之路十四:客户端调用WCF服务的几种方法小议
    工作的思考二:无效的沟通
    ADO.NET 全面梳理
    工作的思考三:工作质量,计划制定,沟通交流
  • 原文地址:https://www.cnblogs.com/LiuPan2016/p/9151951.html
Copyright © 2011-2022 走看看