前端界面嵌套展示及json处理传后台

 界面代码

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pop" uri="/pop-tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<jsp:include page="/common/baseInclude.jsp"></jsp:include>
<link rel="stylesheet" href="${resourcePath}/css/LDAP.css"/>

<div class="container_24">
    <div class="main">
        <form class="form-horizontal" style="padding-bottom: 30px;" id="sourceForm">
            <div class="form-group clearfix">
                <label for="name" class="col-sm-3 control-label">
                    <i style="color: #ffb9a7;padding-right:5px;">*</i>名称
                    :</label>
                <div class="col-sm-9">
                    <input type="text" name="name" class="form-control" id="name" style="width: 40%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="description" class="col-sm-3 control-label">
                    <i style="color: red;padding-right:5px;">*</i>描述
                    :</label>
                <div class="col-sm-9">
                    <input type="text" name="description" class="form-control" id="description" style="width: 40%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="host" class="col-sm-3 control-label">
                    <i style="color: red;padding-right:5px;">*</i>主机 :</label>
                <div class="col-sm-9">
                    <input type="text" name="host" id="host" value="127.0.0.1" class="form-control" placeholder="127.0.0.1" style="display: inline-block;width: 30%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="port" class="col-sm-3 control-label">
                    <i style="color: red;padding-right:5px;">*</i>Port :</label>
                <div class="col-sm-9">
                    <input type="number" name="port" id="port" class="form-control" placeholder="1812" style="width: 20%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="password" class="col-sm-3 control-label">
                    <i style="color: red;padding-right:5px;">*</i>密码
                    :</label>
                <div class="col-sm-9">
                    <input type="password" name="password" class="form-control" id="password" placeholder="Password" style="width: 40%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="timeout" class="col-sm-3 control-label">
                    <i style="color: red;padding-right:5px;">*</i>连接超时 :</label>
                <div class="col-sm-9">
                    <input type="number" name="timeout" id="timeout" class="form-control" placeholder="1" style="width: 20%;">
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="useStripped" class="col-sm-3 control-label">使用被剥夺的用户名:</label>
                <div class="col-sm-9">
                    <input type="checkbox" name="useStripped" id="useStripped" placeholder="Click to add a realm">
                    <p>与此源相关的领域</p>
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="associated" class="col-sm-3 control-label">关联领域:</label>
                <div class="col-sm-9" id="associated">
                    <div title="" id="realms_chosen" style="width: 220px;">
                        <ul data-toggle="dropdown" aria-expanded="true" class="chosen-choices" placeholder="Click to add a realm">
                            <%--放模板的地方--%>
                        </ul>
                        <div class="dropdown-menu" role="menu" aria-labelledby="dLabel" style="margin: -22px 0;padding: 0 12px;width: 41%;" id="menu">
                            <ul class="chosen-results">
                                <li class="result-selected" data-option-array-index="0" style="">default</li>
                                <li class="active-result" data-option-array-index="1" style="">local</li>
                                <li class="active-result" data-option-array-index="2" style="">null</li>
                            </ul>
                        </div>
                    </div>
                    <p>与此源相关的领域</p>
                </div>
            </div>
            <div class="form-group clearfix">
                <label for="rules" class="col-sm-3 control-label">认证规则  :</label>
                <div class="col-sm-9">
                    <span class="btn btn-default" id="rules" >增加新的规则</span>
                    <div class="controls" style="display: none;">
                        <%--认证规则的模板存放的位置--%>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<!-- 模板 -->
<%--认证规则模板--%>
<script type="text/html" id="ruleTpl">
    {{each $data}}
    <div id="accordion-group{{$value.ruleId}}" class="rulesTemp" style="border: 1px solid #ccc;margin-top: 15px;">
        <div style="border-bottom: 1px solid #ccc;padding: 0 20px;height: 40px;padding: 10px 5px;">
            <h3>
                <a onclick="HandoffConcealment.call(this);"><span class="hidden"></span>Rule - New</a>
                <span style="float: right;">
                    <i class="glyphicon glyphicon-plus" onclick="addAccordion()"></i>
                    <i class="glyphicon glyphicon-remove" onclick="minusAccordion.call(this)"></i>
                </span>
            </h3>
        </div>
        <div class="accordion-body collapse in" style="margin-top: 20px;padding: 10px 20px;">
            <%--<form class="form-horizontal">--%>
                <div class="form-group">
                    <label for="rules.{{$value.ruleId}}.id" class="col-sm-2 control-label">名称:</label>
                    <div class="col-sm-10" id="rules.{{$value.ruleId}}.id">
                        <input type="text" name="rulesId" class="form-control" placeholder="name">
                    </div>
                </div>
                <div class="form-group">
                    <label for="rules{{$value.ruleId}}_description" class="col-sm-2 control-label">描述:</label>
                    <div class="col-sm-10" id="rules{{$value.ruleId}}_description">
                        <input type="text" name="rulesDescription" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label for="rules{{$value.ruleId}}_match" class="col-sm-2 control-label">匹配:</label>
                    <div class="col-sm-10" id="rules{{$value.ruleId}}_match">
                        <select name="rulesMatch" class="form-control" style="width: 200px;">
                            <option value="All">All</option>
                            <option value="Any">Any</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="rules{{$value.ruleId}}_conditions" class="col-sm-2 control-label">条件:</label>
                    <div class="col-sm-10" id="rules{{$value.ruleId}}_conditions">
                        <button type="button" class="btn btn-default" onclick="Conditions.call(this)">ADD a conditions</button>
                        <div class="hidden conditions">
                            <span class="hidden">{{$value.ruleId}}</span>
                            <div id="rules{{$value.ruleId}}_conditions0" class="rulesConditionsTemp">
                                <select class="form-control" name="rulesConditionsAttribute" style="display: inline-block;width: 29%;padding: 5px;margin:10px -2px;height: 30px;vertical-align: middle;">
                                    <option value="1">aaaa</option>
                                    <option value="2">bbbbb</option>
                                    <option value="3">ccccc</option>
                                    <option value="4">ddddd</option>
                                </select>
                                <select class="form-control" name="rulesConditionsOperator" style="display: inline-block;width: 26%;padding: 5px;margin:10px -2px;height: 30px;vertical-align: middle;">
                                    <option value="a">aaaa</option>
                                    <option value="b">bbbbb</option>
                                    <option value="c">ccccc</option>
                                    <option value="d">ddddd</option>
                                </select>
                                <input class="form-control" name="rulesConditionsValue" type="text" style="display: inline-block;width: 29%;margin:10px -3px;padding: 3px;height: 30px;vertical-align: middle;">
                                <span aria-hidden="true" class="add-on">
                                    <i class="glyphicon glyphicon-plus" onclick="addConditions.call(this)"></i>
                                    <i class="glyphicon glyphicon-remove" onclick="minus.call(this)"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="rules{{$value.ruleId}}_actions" class="col-sm-2 control-label">操作:</label>
                    <div class="col-sm-10" id="rules{{$value.ruleId}}_actions">
                        <button type="button" class="btn btn-default" onclick="Actions.call(this)">ADD actions</button>
                        <div class="actions hidden">
                            <span class="hidden">{{$value.ruleId}}</span>
                            <div id="rules{{$value.ruleId}}_actions0" class="rulesActionsTemp">
                                <select class="form-control" name="rulesActionsType" style="display: inline-block;width: 40%;padding: 5px;margin:10px -2px;">
                                    <option value="1">aaaa</option>
                                    <option value="2">bbbbb</option>
                                    <option value="3">ccccc</option>
                                    <option value="4">ddddd</option>
                                </select>
                                <select class="form-control" name="rulesActionsValue" style="display: inline-block;width: 40%;padding: 5px;margin:10px -2px;">
                                    <option value="a">aaaa</option>
                                    <option value="b">bbbbb</option>
                                    <option value="c">ccccc</option>
                                    <option value="d">ddddd</option>
                                </select>
                                <span aria-hidden="true" class="add-on">
                                    <i class="glyphicon glyphicon-plus" onclick="addActions.call(this)"></i>
                                    <i class="glyphicon glyphicon-remove" onclick="minus.call(this)"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            <%--</form>--%>
        </div>
    </div>
    {{/each}}
</script>



<%--条件模板--%>
<script type="text/html" id="conditionTpl">
    {{each $data}}
    <div id="rules{{$value.ruleId}}_conditions{{$value.conditionId}}" class="rulesConditionsTemp">
        <select class="form-control" name="rulesConditionsAttribute" style="display: inline-block;width: 29%;padding: 5px;margin:10px -2px;height: 30px;vertical-align: middle;">
            <option value="1">aaaa</option>
            <option value="2">bbbbb</option>
            <option value="3">ccccc</option>
            <option value="4">ddddd</option>
        </select>
        <select class="form-control" name="rulesConditionsOperator" style="display: inline-block;width: 26%;padding: 5px;margin:10px -2px;height: 30px;vertical-align: middle;">
            <option value="a">aaaa</option>
            <option value="b">bbbbb</option>
            <option value="c">ccccc</option>
            <option value="d">ddddd</option>
        </select>
        <input class="form-control" name="rulesConditionsValue"  type="text" style="display: inline-block;width: 29%;margin:10px -3px;padding: 3px;height: 30px;vertical-align: middle;">
        <span aria-hidden="true" class="add-on">
            <i class="glyphicon glyphicon-plus" onclick="addConditions.call(this)"></i>
            <i class="glyphicon glyphicon-remove" onclick="minus.call(this)"></i>
        </span>
    </div>
    {{/each}}
</script>


<%--操作模板--%>
<script type="text/html" id="actionsTpl">
    {{each $data}}
    <div id="rules{{$value.ruleId}}_actions{{$value.actionId}}" class="rulesActionsTemp">
        <select class="form-control" name="rulesActionsType" style="display: inline-block;width: 40%;padding: 5px;margin:10px -2px;">
            <option value="1">aaaa</option>
            <option value="2">bbbbb</option>
            <option value="3">ccccc</option>
            <option value="4">ddddd</option>
        </select>
        <select class="form-control" name="rulesActionsValue" style="display: inline-block;width: 40%;padding: 5px;margin:10px -2px;">
            <option value="a">aaaa</option>
            <option value="b">bbbbb</option>
            <option value="c">ccccc</option>
            <option value="d">ddddd</option>
        </select>
        <span aria-hidden="true" class="add-on">
            <i class="glyphicon glyphicon-plus" onclick="addActions.call(this)"></i>
            <i class="glyphicon glyphicon-remove" onclick="minus.call(this)"></i>
        </span>
    </div>
    {{/each}}
</script>



<script type="text/javascript" src="${resourcePath}/js/template.js"></script>
<script>
    $(function(){
        $("#sourceForm").validate({
            submitHandler: function (form) {
                var realms = []
                $("#realms_chosen ul.chosen-choices li").each(function () {
                    realms.push($(this).find("span:eq(0)").text())
                })

                var rules = []
                $(".rulesTemp").each(function(i) {
                    var ruleConditions = []
                    debugger;
                    $(this).find(".rulesConditionsTemp").each(function(j) {
                        var ruleCondition = {
                            ruleConditionAttribute: $(this).find("[name=rulesConditionsAttribute]").val() || "",
                            ruleConditionOperator: $(this).find("[name=rulesConditionsOperator] ").val() || "",
                            ruleConditionValue: $(this).find("[name=rulesConditionsValue] ").val() || ""
                        }
                        ruleConditions[j] = ruleCondition
                    })


                    var ruleActions = []
                    $(this).find(".rulesActionsTemp").each(function(k) {
                        var ruleAction = {
                            ruleActionType: $(this).find("[name='rulesActionsType']  ").val() || "",
                            ruleActionValue: $(this).find("[name='rulesActionsValue'] ").val() || ""
                        }
                        ruleActions[k] = ruleAction
                    })

                    var rule = {
                        ruleId: $(this).find("[name=rulesId]").val() || "",
                        ruleDescription: $(this).find("[name=rulesDescription]").val() || "",
                        rulesMatch: $(this).find("[name=rulesMatch]").val() || "",
                        ruleConditions: ruleConditions,
                        ruleActions: ruleActions
                    }

                    rules[i] = rule
                })


                var params = {
                    name: $("#name").val() || "",
                    description: $("#description").val() || "",
                    host: $("#host").val() || "",
                    port: $("#port").val() || "",
                    password: $("#password").val() || "",
                    timeout: $("#timeout").val() || "",
                    useStripped: $("#useStripped").val() || "",
                    realms: realms,
                    rules: rules
                }
                debugger;

                // $(form).formSubmit({
                //
                // })
                $.ajax({
                    url: "${path}/manage/authSource/add.do",
                    type: 'post',
                    dataType:'json',
                    contentType: "application/json; charset=utf-8",
                    data: JSON.stringify(params),
                    success: function (data) {
                        if (data == "success") {
                            $.messageBox("编辑成功!");
                        } else {
                            $.confirmBox({type: 'warn', msg: "error", defaultCloseBtnName: '确认'})
                        }
                        $("#sourceListTable").reloadJqGrid();
                        $("#sourceDialog").closeDialog();
                    }
                })
                return false;
            }

        });
        $("#rules").click(function(){
            $(".controls").show();
            $(this).hide();
        })
        $(".chosen-results").on('click','li',function () {
            var text = $(this).text();
            var tpl = '<li class="search-choice" style="position:relative;"><span>'+text+'</span><span style="position: absolute;top: 3px; right: 3px;" class="deleteAssociated">X</span></li>';
            $(tpl).appendTo($(".chosen-choices"));
            $(this).addClass("disabled");
        })
        $(".chosen-choices").on('click','.deleteAssociated',function () {
            $(this).parent().remove();
            var text = $(this).siblings('span').text();
            var liList = $('#menu').children().find('li');
            liList.each(function () {
                if ($(this).text() == text){
                    $(this).removeClass('disabled');
                }
            })
        })
        $(".disabled").click(function (event) {
            return false;
        });
        addAccordion();
    })
    function Conditions(){
        $(this).hide();
        $(this).siblings('div').show();
    }
    function Actions() {
        $(this).hide();
        $(this).siblings('div').show();
    }
    function addAccordion(){
        var length = $(".controls>div").length;
        var ruleId = length;
        var $addcontrols = $(".controls");
        var html = template('ruleTpl',[{ruleId:ruleId}]);
        $(html).appendTo($addcontrols);
    }
    function minusAccordion() {
        var length = $(".controls>div").length;
        if (length>1){
            $(this).parent().parent().parent().parent().remove();
        }else {
            $(".controls").hide();
            $(this).parent().parent().parent().parent().parent().siblings('span').show();
        }
    }
    function addConditions() {
        var ruleId = $(this).parent().parent().siblings('span').text();
        var length = $(this).parent().parent().parent().find("div").length;
        var conditionId = length;
        var html = template('conditionTpl',[{ruleId:ruleId,conditionId:conditionId}]);
        $(this).parent().parent().parent().append(html);
    }
    function minus() {
        var length = $(this).parent().parent().parent().find("div").length;
        if (length>1){
            $(this).parent().parent().remove();
        }else {
            $(this).parent().parent().parent().hide();
            $(this).parent().parent().parent().siblings('button').show();
        }
    }
    function addActions(){
        var ruleId = $(this).parent().parent().siblings('span').text();
        var length = $(this).parent().parent().parent().find("div").length;
        var actionId = length;
        var html = template('actionsTpl',[{ruleId:ruleId,actionId:actionId}]);
        $(this).parent().parent().parent().append(html);
    }
    function HandoffConcealment() {
        $(this).parent().parent().siblings('div').slideToggle();
    }

</script>

样式处理的js插件

/*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
!function () {
    function a(a) {
        return a.replace(t, "").replace(u, ",").replace(v, "").replace(w, "").replace(x, "").split(y)
    }

    function b(a) {
        return "'" + a.replace(/('|\\)/g, "\\$1").replace(/\r/g, "\\r").replace(/\n/g, "\\n") + "'"
    }

    function c(c, d) {
        function e(a) {
            return m += a.split(/\n/).length - 1, k && (a = a.replace(/\s+/g, " ").replace(/<!--[\w\W]*?-->/g, "")), a && (a = s[1] + b(a) + s[2] + "\n"), a
        }

        function f(b) {
            var c = m;
            if (j ? b = j(b, d) : g && (b = b.replace(/\n/g, function () {
                return m++, "$line=" + m + ";"
            })), 0 === b.indexOf("=")) {
                var e = l && !/^=[=#]/.test(b);
                if (b = b.replace(/^=[=#]?|[\s;]*$/g, ""), e) {
                    var f = b.replace(/\s*\([^\)]+\)/, "");
                    n[f] || /^(include|print)$/.test(f) || (b = "$escape(" + b + ")")
                } else b = "$string(" + b + ")";
                b = s[1] + b + s[2]
            }
            return g && (b = "$line=" + c + ";" + b), r(a(b), function (a) {
                if (a && !p[a]) {
                    var b;
                    b = "print" === a ? u : "include" === a ? v : n[a] ? "$utils." + a : o[a] ? "$helpers." + a : "$data." + a, w += a + "=" + b + ",", p[a] = !0
                }
            }), b + "\n"
        }

        var g = d.debug, h = d.openTag, i = d.closeTag, j = d.parser, k = d.compress, l = d.escape, m = 1,
            p = {$data: 1, $filename: 1, $utils: 1, $helpers: 1, $out: 1, $line: 1}, q = "".trim,
            s = q ? ["$out='';", "$out+=", ";", "$out"] : ["$out=[];", "$out.push(", ");", "$out.join('')"],
            t = q ? "$out+=text;return $out;" : "$out.push(text);",
            u = "function(){var text=''.concat.apply('',arguments);" + t + "}",
            v = "function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);" + t + "}",
            w = "'use strict';var $utils=this,$helpers=$utils.$helpers," + (g ? "$line=0," : ""), x = s[0],
            y = "return new String(" + s[3] + ");";
        r(c.split(h), function (a) {
            a = a.split(i);
            var b = a[0], c = a[1];
            1 === a.length ? x += e(b) : (x += f(b), c && (x += e(c)))
        });
        var z = w + x + y;
        g && (z = "try{" + z + "}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:" + b(c) + ".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");
        try {
            var A = new Function("$data", "$filename", z);
            return A.prototype = n, A
        } catch (B) {
            throw B.temp = "function anonymous($data,$filename) {" + z + "}", B
        }
    }

    var d = function (a, b) {
        return "string" == typeof b ? q(b, {filename: a}) : g(a, b)
    };
    d.version = "3.0.0", d.config = function (a, b) {
        e[a] = b
    };
    var e = d.defaults = {openTag: "<%", closeTag: "%>", escape: !0, cache: !0, compress: !1, parser: null},
        f = d.cache = {};
    d.render = function (a, b) {
        return q(a, b)
    };
    var g = d.renderFile = function (a, b) {
        var c = d.get(a) || p({filename: a, name: "Render Error", message: "Template not found"});
        return b ? c(b) : c
    };
    d.get = function (a) {
        var b;
        if (f[a]) b = f[a]; else if ("object" == typeof document) {
            var c = document.getElementById(a);
            if (c) {
                var d = (c.value || c.innerHTML).replace(/^\s*|\s*$/g, "");
                b = q(d, {filename: a})
            }
        }
        return b
    };
    var h = function (a, b) {
        return "string" != typeof a && (b = typeof a, "number" === b ? a += "" : a = "function" === b ? h(a.call(a)) : ""), a
    }, i = {"<": "&#60;", ">": "&#62;", '"': "&#34;", "'": "&#39;", "&": "&#38;"}, j = function (a) {
        return i[a]
    }, k = function (a) {
        return h(a).replace(/&(?![\w#]+;)|[<>"']/g, j)
    }, l = Array.isArray || function (a) {
        return "[object Array]" === {}.toString.call(a)
    }, m = function (a, b) {
        var c, d;
        if (l(a)) for (c = 0, d = a.length; d > c; c++) b.call(a, a[c], c, a); else for (c in a) b.call(a, a[c], c)
    }, n = d.utils = {$helpers: {}, $include: g, $string: h, $escape: k, $each: m};
    d.helper = function (a, b) {
        o[a] = b
    };
    var o = d.helpers = n.$helpers;
    d.onerror = function (a) {
        var b = "Template Error\n\n";
        for (var c in a) b += "<" + c + ">\n" + a[c] + "\n\n";
        "object" == typeof console && console.error(b)
    };
    var p = function (a) {
            return d.onerror(a), function () {
                return "{Template Error}"
            }
        }, q = d.compile = function (a, b) {
            function d(c) {
                try {
                    return new i(c, h) + ""
                } catch (d) {
                    return b.debug ? p(d)() : (b.debug = !0, q(a, b)(c))
                }
            }

            b = b || {};
            for (var g in e) void 0 === b[g] && (b[g] = e[g]);
            var h = b.filename;
            try {
                var i = c(a, b)
            } catch (j) {
                return j.filename = h || "anonymous", j.name = "Syntax Error", p(j)
            }
            return d.prototype = i.prototype, d.toString = function () {
                return i.toString()
            }, h && b.cache && (f[h] = d), d
        }, r = n.$each,
        s = "break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",
        t = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,
        u = /[^\w$]+/g, v = new RegExp(["\\b" + s.replace(/,/g, "\\b|\\b") + "\\b"].join("|"), "g"),
        w = /^\d[^,]*|,\d[^,]*/g, x = /^,+|,+$/g, y = /^$|,+/;
    e.openTag = "{{", e.closeTag = "}}";
    var z = function (a, b) {
        var c = b.split(":"), d = c.shift(), e = c.join(":") || "";
        return e && (e = ", " + e), "$helpers." + d + "(" + a + e + ")"
    };
    e.parser = function (a) {
        a = a.replace(/^\s/, "");
        var b = a.split(" "), c = b.shift(), e = b.join(" ");
        switch (c) {
            case"if":
                a = "if(" + e + "){";
                break;
            case"else":
                b = "if" === b.shift() ? " if(" + b.join(" ") + ")" : "", a = "}else" + b + "{";
                break;
            case"/if":
                a = "}";
                break;
            case"each":
                var f = b[0] || "$data", g = b[1] || "as", h = b[2] || "$value", i = b[3] || "$index", j = h + "," + i;
                "as" !== g && (f = "[]"), a = "$each(" + f + ",function(" + j + "){";
                break;
            case"/each":
                a = "});";
                break;
            case"echo":
                a = "print(" + e + ");";
                break;
            case"print":
            case"include":
                a = c + "(" + b.join(",") + ");";
                break;
            default:
                if (/^\s*\|\s*[\w\$]/.test(e)) {
                    var k = !0;
                    0 === a.indexOf("#") && (a = a.substr(1), k = !1);
                    for (var l = 0, m = a.split("|"), n = m.length, o = m[l++]; n > l; l++) o = z(o, m[l]);
                    a = (k ? "=" : "=#") + o
                } else a = d.helpers[c] ? "=#" + c + "(" + b.join(",") + ");" : "=" + a
        }
        return a
    }, "function" == typeof define ? define(function () {
        return d
    }) : "undefined" != typeof exports ? module.exports = d : this.template = d
}();

 提交给后台必须是json对象而不是queryString

 后台接收类(Controller用@RequestBody TestAuth testauth)

package com.tipray.bean;

import java.util.List;

public class TestAuth {
    private String name;
    private String description;
    private String host;
    private String port;
    private String password;
    private String timeout;
    private String useStripped;
    private List<String> realms;
    private List<Rules> rules;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTimeout() {
        return timeout;
    }

    public void setTimeout(String timeout) {
        this.timeout = timeout;
    }

    public List<Rules> getRules() {
        return rules;
    }

    public void setRules(List<Rules> rules) {
        this.rules = rules;
    }

    public String getUseStripped() {
        return useStripped;
    }

    public void setUseStripped(String useStripped) {
        this.useStripped = useStripped;
    }

    public List<String> getRealms() {
        return realms;
    }

    public void setRealms(List<String> realms) {
        this.realms = realms;
    }
}
package com.tipray.bean;

import com.sun.deploy.security.ruleset.RuleAction;

import java.util.List;

public class Rules {
    private String ruleId;
    private String ruleDescription;
    private String rulesMatch;
    private List<Condition> ruleConditions;
    private List<Actions> ruleActions;

    public String getRuleId() {
        return ruleId;
    }

    public void setRuleId(String ruleId) {
        this.ruleId = ruleId;
    }

    public String getRuleDescription() {
        return ruleDescription;
    }

    public void setRuleDescription(String ruleDescription) {
        this.ruleDescription = ruleDescription;
    }

    public String getRulesMatch() {
        return rulesMatch;
    }

    public void setRulesMatch(String rulesMatch) {
        this.rulesMatch = rulesMatch;
    }

    public List<Condition> getRuleConditions() {
        return ruleConditions;
    }

    public List<Actions> getRuleActions() {
        return ruleActions;
    }

    public void setRuleActions(List<Actions> ruleActions) {
        this.ruleActions = ruleActions;
    }

    public void setRuleConditions(List<Condition> ruleConditions) {
        this.ruleConditions = ruleConditions;
    }


}
package com.tipray.bean;

public class Actions {
    private String ruleActionType;
    private String ruleActionValue;

    public String getRuleActionType() {
        return ruleActionType;
    }

    public void setRuleActionType(String ruleActionType) {
        this.ruleActionType = ruleActionType;
    }

    public String getRuleActionValue() {
        return ruleActionValue;
    }

    public void setRuleActionValue(String ruleActionValue) {
        this.ruleActionValue = ruleActionValue;
    }
}
package com.tipray.bean;

public class Condition {
    private String ruleConditionAttribute;
    private String ruleConditionOperator;
    private String ruleConditionValue;

    public String getRuleConditionAttribute() {
        return ruleConditionAttribute;
    }

    public void setRuleConditionAttribute(String ruleConditionAttribute) {
        this.ruleConditionAttribute = ruleConditionAttribute;
    }

    public String getRuleConditionOperator() {
        return ruleConditionOperator;
    }

    public void setRuleConditionOperator(String ruleConditionOperator) {
        this.ruleConditionOperator = ruleConditionOperator;
    }

    public String getRuleConditionValue() {
        return ruleConditionValue;
    }

    public void setRuleConditionValue(String ruleConditionValue) {
        this.ruleConditionValue = ruleConditionValue;
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值