list页面和from页面

list页面(list数据页面):

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>Baseline Management</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
    function page(n, s) {
        if (n)
            $("#pageNo").val(n);
        if (s)
            $("#pageSize").val(s);
        $("#searchForm").attr("action", "${ctx}/ito/commonbaseline/list");
        $("#searchForm").submit();
        return false;
    }

    function myreset() {
        $(':input', '#searchForm').not(':button, :submit, :reset, :hidden')
                .val('').removeAttr('checked').removeAttr('selected');
        $("#searchForm").submit();
        return false;
    }
</script>
<style type="text/css">
.table thead tr th, .table thead tr td {
    vertical-align: middle;
    text-align: center;
}

.select {
     280px;
}
</style>
</head>


<body>
    <ul class="nav nav-tabs">
        <li class="active"><a href="${ctx}/delivery/resourceinfo/list">List</a></li>
        <shiro:hasPermission name="delivery:projectBasic:edit">
            <li><a href="${ctx}/delivery/resourceinfo/form">Add</a></li>
        </shiro:hasPermission>
    </ul>
    <form:form id="searchForm" modelAttribute="dpmResourceInformation"
        action="${ctx}/delivery/resourceinfo/" method="post"
        class="breadcrumb form-search">
        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
        <input id="pageSize" name="pageSize" type="hidden"
            value="${page.pageSize}" />
        <li><label>类型:</label> <form:select id="type" path="type" class="input-medium select">
                <form:option value="">----select----</form:option>
                <form:option value="HS">人力来源</form:option>
                <form:option value="WP">工作场所</form:option>
            </form:select>
            </li>
        <li><label>名称:</label> <form:input path="name" htmlEscape="false" class="input-medium" /></li>

        <input id="btnSubmit" class="btn btn-primary" type="submit"
            value="Search" />
        <input class="btn btn-primary" type="button" value="Reset"
            onclick="return myreset();" />
    </form:form>
    <sys:message content="${message}" />
    <table id="contentTable"
        class="table table-striped table-bordered table-condensed">
        <thead>
            <tr>
                <th>No</th>
                <th>项目名称</th>
                <th>类型</th>
                <th>名称</th>
                <th>sort</th>
                <th>rmarks</th>
                <shiro:hasPermission name="delivery:projectBasic:edit">
                    <th>操作</th>
                </shiro:hasPermission>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${page.list}" var="projectBasic" varStatus="status">
                <tr>
                    <td>${(status.index+1)+(page.pageNo-1)*page.pageSize}</td>
                    <td><a
                        href="${ctx}/delivery/resourceinfo/form?id=${projectBasic.id}">${projectBasic.projectName}</a></td>
                    <td>${projectBasic.type}</td>
                    <td>${projectBasic.name}</td>
                    <td>${projectBasic.sort}</td>
                    <td>${projectBasic.remarks}</td>
                    <shiro:hasPermission name="delivery:projectBasic:edit">
                        <td><a
                            href="${ctx}/delivery/resourceinfo/form?id=${projectBasic.id}">[edit]</a>
                            <a href="${ctx}/delivery/resourceinfo/delete?id=${projectBasic.id}" onclick="return confirmx('Do you want to delete the dictionary?', this.href)">[delete]</a>
                        </td>
                    </shiro:hasPermission>
                </tr>
            </c:forEach>
        </tbody>
    </table>
    <div class="pagination">${page}</div>
</body>
</html>

form表单页面(用于添加和修改)

<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>Baseline Management</title>
<meta name="decorator" content="default" />
<style type="text/css">
.left {
    float: left;
    clear: left;
     40%;
}

.right {
    float: left;
    padding-left: 20px;
}

.select {
     220px;
}
</style>
<script type="text/javascript">
        $(document).ready(function() {
            $("#value").focus();
            $("#inputForm").validate({
                submitHandler: function(form){
                    loading('Submitting, please wait...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("Input incorrectly, please correct it.");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        if(element.is(".my_add-on")){
                            error.insertAfter(element.next());
                        }else{
                            error.insertAfter(element);
                        }
                    }
                }
            });
        });
        
        
    </script>
</head>
<body>
    <ul class="nav nav-tabs">
        <li><a href="${ctx}/delivery/resourceinfo/list">List</a></li>
        <li class="active"><a
            href="${ctx}/delivery/resourceinfo/form?id=${dpmResourceInformation.id}"><shiro:hasPermission
                    name="delivery:projectBasic:view">${not empty dpmProjectBasic.id?'Edit':'Add'}</shiro:hasPermission>
        </a></li>
    </ul>
    <br />
    <form:form id="inputForm" modelAttribute="dpmResourceInformation"
        action="${ctx}/delivery/resourceinfo/save" method="post"
        class="form-horizontal">
        <form:hidden path="id" />
        <sys:message content="${message}" />




        <div class="control-group">
            <label class="control-label">项目名称:</label>
            <div class="controls">
                <form:select path="projectBasicId" htmlEscape="false"
                    style="220px" class="required">
                    <form:option value="">----select----</form:option>
                    <form:options items="${projectList}" itemLabel="projectName"
                        itemValue="projectBasicId" />
                </form:select>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>


        <div class="control-group">

            <label class="control-label">名称:</label>
            <div class="controls">
                <form:input path="name" htmlEscape="false" maxlength="50"
                    class="required" />
                <span class="help-inline"><font color="red">*</font> </span>
            </div>


        </div>

        <div class="control-group">
            <label class="control-label">类型:</label>
            <div class="controls">
                <form:select id="type" path="type" class="input-medium select">
                    <form:option value="">----select----</form:option>
                    <form:option value="HS">人力来源</form:option>
                    <form:option value="WP">工作场所</form:option>
                </form:select>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>


        <div class="control-group">
            <label class="control-label">sort:</label>
            <div class="controls">
                <form:input path="sort" htmlEscape="false" maxlength="50"
                    class="required" />
                <span class="help-inline"><font color="red">*</font> </span>
            </div>

        </div>
        <div class="control-group">
            <label class="control-label">Remark:</label>
            <div class="right">
                <form:textarea path="remarks" htmlEscape="false" rows="3"
                    maxlength="200" class="input-xlarge" />
            </div>
        </div>


        <div class="form-actions">
            <shiro:hasPermission name="delivery:projectBasic:edit">
                <input id="btnSubmit" class="btn btn-primary" type="submit"
                    value="Save" />&nbsp;</shiro:hasPermission>
            <input id="btnCancel" class="btn" type="button" value="Back"
                onclick="history.go(-1)" />
        </div>
    </form:form>
</body>
</html>
原文地址:https://www.cnblogs.com/jiajialeps/p/10163063.html