登入页面
角色列表:
用户列表
角色添加:
权限列表:
权限添加:
商品列表:
商品添加:
用户列表视图:userlist.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <s:form> <div class="btn-group" > <a href="user_upadd" class="btn btn-small">添加</a> <button id="rew" class="btn btn-small">修改</button> <button id="del" class="btn btn-small">删除</button> </div> <table class="table table-condensed table-hover table-bordered"> <thead> <tr> <th>ID</th> <th>姓名</th> <th>年龄</th> <th>性别</th> <th>职称</th> <th>mail</th> <th>角色</th> <th>添加时间</th> <th>修改时间</th> <th>状态</th> </tr> </thead> <!--等待编辑--> <s:iterator value="users"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" theme="simple" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><s:property value="age" /> </td> <td><s:property value="sex" /></td> <td><s:property value="position" /></td> <td><s:property value="mail" /></td> <td><s:property value="group.getName()" /></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="state == 1">有效</s:if> <s:else>无效</s:else> </td> </tr> </s:iterator> </table> </s:form> <s:set value="page" var="curr" /><!--起始页 --> <s:set value="totalPage" var="countPage"/><!-- 页码总数 --> <div class="pagination pagination-centered"> <ul> <li><a href="user_list?page=1">首页 </a></li> <li><a href='<s:if test="#curr > 1">user_list?page=<s:property value="#curr - 1" /></s:if><s:else>#</s:else>'>上一页 </a></li> <s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="startNum" /> <s:param name="last" value="endNum" /> <s:iterator> <li><a href='user_list?page=<s:property/>'><s:property/></a><li> </s:iterator> </s:bean> <li><a href='<s:if test="#curr < #countPage">user_list?page=<s:property value="#curr + 1" /></s:if><s:else>#</s:else>'>下一页 </a></li> <li><a href='user_list?page=<s:property value="#countPage" />'>尾页</a></li> </ul> </div> </div> </div> </div> <script type="text/javascript" src="bootstrap/js/jquery-1.10.1.min.js"></script> <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#rew").click(function(){ $("form").attr("action","user_addui"); $("form").submit(); }); $("#del").click(function(){ $("form").attr("action","user_del"); $("form").submit(); }); }); </script> </body> </html>
用户添加视图:userinfo.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags" %> <s:set value="upuser" var="u" /> <s:debug /> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>user info</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="contaniner-fluid"> <div class="row-fluid"> <s:form class="form-horizontal" theme="simple" > <s:hidden name="user.id" value="%{#u.id}"/> <div class="span6"> <!----> <h4 class="brand"><s:if test="#u.id != null">修改用户</s:if><s:else>添加用户</s:else></h4> <div class="btn-group" > <a href="user_list" class="btn">返回</a> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >用户名称 <s:textfield placeholder="用户名称" name="user.name" value='%{#u.name}'> </s:textfield> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >用户密码 <s:password placeholder="用户密码" name="user.pass" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >年龄 <s:textfield placeholder="年龄" name="user.age" value='%{#u.age}' /> </label> </div> </div> <s:radio label="性别" list="#{'男':'男','女':'女'}" name="user.sex" value="%{#u.sex}" /> <div class="control-group"> <div class="controls"> <label class="control-label" >职称 <s:textfield placeholder="职称" size="100" name="user.position" value='%{#u.position}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label">mail <s:textfield placeholder="mail" size="100" name="user.mail" value='%{#u.mail}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label">角色 <s:select name="user.group.id" list="addGroups" headerKey="0" headerValue="请选择" value='%{#u.group.id}' listValue="name" listKey="id" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >状态 <s:select name="user.state" list="#{'1':'有效','2':'无效'}" headerKey="0" headerValue="请选择" value='%{#u.state}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <button <s:if test="#u.id != null">id="up"</s:if><s:else>id="add"</s:else> class="btn"><s:if test="#u.id != null">修改</s:if><s:else>添加</s:else></button> </div> </div> </div> <div class="span6"> <!----> </div> </s:form> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#add").click(function(){ $("form").attr("action","user_add"); $("form").submit(); }) $("#up").click(function(){ $("form").attr("action","user_up"); $("form").submit(); }) }) </script> </body> </html>
角色列表视图:grouplist.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>group list</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <s:form theme="simple"> <input type="hidden" id="hiddenmyform"/> <input type="hidden" id="hiddenmethod"/> <div class="btn-group" > <a href="group_upadd" class="btn btn-small">添加</a> <button id="rew" class="btn btn-small">修改</button> <button id="del" class="btn btn-small">删除</button> </div> <table class="table table-condensed table-hover table-bordered"> <thead> <tr> <th> ID </th> <th> 名称 </th> <th> 添加时间 </th> <th> 修改时间 </th> <th> 状态 </th> </tr> </thead> <s:iterator value="groups"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><s:property value="createdate" /></td> <td><s:property value="reworkdate" /></td> <td><s:if test="state == 1">有效</s:if> <s:else>无效</s:else> </td> </tr> </s:iterator> </table> </s:form> <s:set value="page" var="curr" /><!--起始页 --> <s:set value="totalPage" var="countPage"/><!-- 页码总数 --> <div class="pagination pagination-centered"> <ul> <li><a href="group_list?page=1">首页 </a></li> <li><a href='<s:if test="#curr > 1">group_list?page=<s:property value="#curr - 1" /></s:if><s:else>#</s:else>'>上一页 </a></li> <s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="startNum" /> <s:param name="last" value="endNum" /> <s:iterator> <li><a href='group_list?page=<s:property/>'><s:property/></a><li> </s:iterator> </s:bean> <li><a href='<s:if test="#curr < #countPage">group_list?page=<s:property value="#curr + 1" /></s:if><s:else>#</s:else>'>下一页 </a></li> <li><a href='group_list?page=<s:property value="#countPage" />'>尾页</a></li> </ul> </div> </div> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#rew").click(function(){ $("form").attr("action","group_addui"); $("form").submit(); }) $("#del").click(function(){ $("form").attr("action","group_del"); $("form").submit(); }) }) </script> </body> </html>
角色添加视图:groupinfo.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags" %> <s:set value="upgroup" var="g" /> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>group info</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="contaniner-fluid"> <div class="row-fluid"> <s:form class="form-horizontal" theme="simple"> <div class="span6"> <!----> <input type="hidden" id="myf"/> <input type="hidden" id="met"/> <s:hidden name="group.id" value="%{#g.id}" /> <h4 class="brand"><s:if test="#g.id != null">修改角色</s:if><s:else>添加角色</s:else></h4> <div class="btn-group" > <a href="group_list" class="btn">返回</a> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >角色名称 <s:textfield placeholder="角色名称" name="group.name" value="%{#g.name}" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >状态 <s:select name="group.state" list="#{'1':'有效','2':'无效'}" headerKey="0" headerValue="请选择" value='%{#g.state}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <button <s:if test="#g.id != null">id="up"</s:if><s:else>id="add"</s:else> class="btn"> <s:if test="#g.id != null">修改</s:if><s:else>添加</s:else> </button> </div> </div> </div> <div class="span6"> <!----> <h4>权限</h4> <div class="container-fluid" > <table class="table table-bordered table-striped" > <thead> <tr> <th>选择</th> <th>权限</th> <th>权限描述</th> </tr> </thead> <tbody> <!-- 权限编辑 --> <s:set value="myMap" id="map"/> <s:iterator value="addAuthority" id="adds"> <tr> <td> <s:if test="#map.get(id) != null "><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="true" /><s:property value="id"/></s:if> <s:else><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="false" /><s:property value="id"/></s:else> </td> <td><s:property value="authorityName"/></td> <td><s:property value="description"/></td> </tr> <s:iterator value="#adds.getaLists()" id="aws"> <tr> <td> <s:if test="#map.get(id) != null"><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="true" /><s:property value="id"/></s:if> <s:else><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="false" /><s:property value="id"/></s:else> </td> <td><s:property value="authorityName"/></td> <td><s:property value="description"/></td> </tr> <s:iterator value="#aws.getaLists()"> <tr> <td> <s:if test="#map.get(id) != null "><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="true" /><s:property value="id"/></s:if> <s:else><s:checkbox label="id" name="upaid" fieldValue="%{id}" value="false" /><s:property value="id"/></s:else> </td> <td><s:property value="authorityName"/></td> <td><s:property value="description"/></td> </tr> </s:iterator> </s:iterator> </s:iterator> </tbody> </table> </div> </div> </s:form> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#add").click(function(){ $("form").attr("action","group_add"); $("form").submit(); }) $("#up").click(function(){ $("form").attr("action","group_up"); $("form").submit(); }) }); </script> <s:debug /> </body> </html>
权限列表视图:authoritylist.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>authority list</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td,th{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <s:form theme="simple"> <input type="hidden" id="myf" /> <input type="hidden" id="met" /> <div class="btn-group" > <a href="authority_upadd" class="btn btn-small" >添加</a> <button type="button" class="btn btn-small" id="rew" >修改</button> <button type="button" class="btn btn-small" id="del" >删除</button> </div> <table class="table table-condensed table-hover table-bordered"> <thead> <tr> <th>ID</th> <th>权限名称</th> <th>权限描述</th> <th>路径</th> <th>添加时间</th> <th>修改时间</th> <th>状态 </th> </tr> <s:iterator value="authoritys" id="ao"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> <td><s:property value="path" /></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> <s:iterator value="#ao.getaLists()" id="at"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> <td><s:property value="path" /></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> <s:iterator value="#at.getaLists()" id="ath"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> <td><s:property value="path" /></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> </s:iterator> </s:iterator> </s:iterator> </thead> </table> </s:form> <s:set value="page" var="curr" /><!--起始页 --> <s:set value="totalPage" var="countPage"/><!-- 页码总数 --> <div class="pagination pagination-centered"> <ul> <li><a href="authority_list?page=1">首页 </a></li> <li><a href='<s:if test="#curr > 1">authority_list?page=<s:property value="#curr - 1" /></s:if><s:else>#</s:else>'>上一页 </a></li> <s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="startNum" /> <s:param name="last" value="endNum" /> <s:iterator> <li><a href='authority_list?page=<s:property/>'><s:property/></a><li> </s:iterator> </s:bean> <li><a href='<s:if test="#curr < #countPage">authority_list?page=<s:property value="#curr + 1" /></s:if><s:else>#</s:else>'>下一页 </a></li> <li><a href='authority_list?page=<s:property value="#countPage" />'>尾页</a></li> </ul> </div> </div> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#rew").click(function(){ $("form").attr("action","authority_addui"); $("form").submit(); }) $("#del").click(function(){ $("form").attr("action","authority_del"); $("form").submit(); }) }) </script> <s:debug/> </body> </html>
权限添加视图:authorityinfo.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <s:set value="upauthority" var="a" /> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>authorityinfo</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="contaniner-fluid"> <div class="row-fluid"> <s:form class="form-horizontal" theme="simple"> <div class="span6"> <!----> <s:hidden name="authority.id" value="%{#a.id}" /> <h4 class="brand"><s:if test="#a.id != null">修改权限</s:if><s:else>添加权限</s:else> <div class="btn-group" > <a href="authority_list" class="btn">返回</a> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >权限名称 <s:textfield placeholder="权限名称" name="authority.authorityName" value="%{#a.authorityName}" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >权限描述 <s:textarea rows="3" name="authority.description" value="%{#a.description}" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >路径 <s:textfield placeholder="路径" name="authority.path" value="%{#a.path}" /> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >状态 <s:select name="authority.state" list="#{'1':'有效','2':'无效'}" headerKey="0" headerValue="请选择" value='%{#a.state}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <button <s:if test="#a.id != null">id="up"</s:if><s:else>id="add"</s:else> class="btn"> <s:if test="#a.id != null">修改</s:if><s:else>添加</s:else> </button> </div> </div> </div> <div class="span6"> <!----> <h4>权限</h4> <div class="container-fluid" > <table class="table table-bordered table-striped" > <thead> <tr> <th>选择</th> <th>权限</th> <th>权限描述</th> </tr> </thead> <tbody> <s:iterator value="authoritys" id="ao"> <tr> <td> <s:radio list="%{#{id:id}}" name="authority.pid" value="%{#a.pid}" /> </td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> </tr> <s:iterator value="#ao.getaLists()" id="at"> <tr> <td><s:radio list="%{#{id:id}}" name="authority.pid" value="%{#a.pid}" /></td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> </tr> <s:iterator value="#at.getaLists()" id="ath"> <tr> <td><s:property value="id"/></td> <td><s:property value="authorityName" /></td> <td><s:property value="description" /></td> </tr> </s:iterator> </s:iterator> </s:iterator> </tbody> </table> </div> </div> </s:form> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#add").click(function(){ $("form").attr("action","authority_add"); $("form").submit(); }) $("#up").click(function(){ $("form").attr("action","authority_up"); $("form").submit(); }) }); </script> </body> </html>
商品分类列表视图:commodityclasslist.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>commodity class list</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td,th{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <s:form theme="simple"> <div class="btn-group" > <a href="commodityClass_upadd" class="btn btn-small">添加</a> <button type="button" class="btn btn-small" id="rew" >修改</button> <button type="button" class="btn btn-small" id="del" >删除</button> </div> <table class="table table-condensed table-hover table-bordered"> <thead> <tr> <th> ID </th> <th> 分类名称 </th> <th> 商品 </th> <th> 添加时间 </th> <th> 修改时间 </th> <th> 状态 </th> </tr> <s:iterator value="ccs" id="ao"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/120x80" alt="120x80" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="#state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> <s:iterator value="#ao.getaLists()" id="at"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/120x80" alt="120x80" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul></td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="#state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> <s:iterator value="#at.getaLists()" id="ath"> <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/120x80" alt="120x80" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="#state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> <s:iterator value="#ath.getaLists()" > <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="name" /></td> <td><ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/120x80" alt="120x80" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> <td><s:property value="createDate" /></td> <td><s:property value="reworkDate" /></td> <td><s:if test="#state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> </s:iterator> </s:iterator> </s:iterator> </s:iterator> </thead> </table> </s:form> <s:set value="page" var="curr" /><!--起始页 --> <s:set value="totalPage" var="countPage"/><!-- 页码总数 --> <div class="pagination pagination-centered"> <ul> <li><a href="commodityClass_list?page=1">首页 </a></li> <li><a href='<s:if test="#curr > 1">commodityClass_list?page=<s:property value="#curr - 1" /></s:if><s:else>#</s:else>'>上一页 </a></li> <s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="startNum" /> <s:param name="last" value="endNum" /> <s:iterator> <li><a href='commodityClass_list?page=<s:property/>'><s:property/></a><li> </s:iterator> </s:bean> <li><a href='<s:if test="#curr < #countPage">commodityClass_list?page=<s:property value="#curr + 1" /></s:if><s:else>#</s:else>'>下一页 </a></li> <li><a href='commodityClass_list?page=<s:property value="#countPage" />'>尾页</a></li> </ul> </div> </div> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#rew").click(function(){ $("form").attr("action","commodityClass_addui"); $("form").submit(); }) $("#del").click(function(){ $("form").attr("action","commodityClass_del"); $("form").submit(); }) }) </script> </body> </html>
商品分类添加视图:commodityclassinfo.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <s:set value="upcommodityclass" var="cc" /> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>commodity class info</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td,th{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="contaniner-fluid"> <div class="row-fluid"> <s:form class="form-horizontal" theme="simple" > <div class="span6"> <!----> <s:hidden name="commodityclass.id" value="%{#cc.id}" /> <h4 class="brand"><s:if test="#cc.id != unll ">修改商品</s:if><s:else>添加商品</s:else></h4> <div class="btn-CommodityClass_Entity" > <a href="commodityClass_list" class="btn">返回</a> </div> <div class="control-group"> <div class="controls"> <label class="control-label">商品名称 <s:textfield placeholder="商品名称" name="commodityclass.name" value="%{#cc.name}" /> </label> </div> </div> <div class="control-group"> <label class="control-label" for="text03">商品图片</label> <div class="controls"> <img class="img-polaroid" alt="160x120" width="30%" src='<s:url value="/upload/%{#cc.path}"/>' /> <s:file class="input-file" placeholder="图片地址" size="100" name="pic" value=""/> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >状态 <s:select name="commodityclass.state" list="#{'1':'有效','2':'无效'}" headerKey="0" headerValue="请选择" value='%{#cc.state}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <button <s:if test="#cc.id != null">id="rew"</s:if><s:else>id="add"</s:else> class="btn"> <s:if test="#cc.id != null">修改</s:if><s:else>添加</s:else> </button> </div> </div> </div> <div class="span6"> <!----> <h4>商品分类</h4> <div class="container-fluid" > <table class="table table-bordered table-striped" > <thead> <tr> <th>选择</th> <th>商品分类</th> <th>商品</th> </tr> </thead> <tbody> <s:iterator value="ccs" id="cco"> <tr> <td> <s:radio list="%{#{id:id}}" name="commodityclass.pid" value="%{#cc.pid}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#cco.getaLists()" id="cct"> <tr> <td> <s:radio list="%{#{id:id}}" name="commodityclass.pid" value="%{#cc.pid}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#cct.getaLists()" id="ccws"> <tr> <td> <s:radio list="%{#{id:id}}" name="commodityclass.pid" value="%{#cc.pid}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#ccws.getaLists()" > <tr> <td><s:property value="id" /></td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path}"/>'/> </div> </li> </ul> </td> </tr> </s:iterator> </s:iterator> </s:iterator> </s:iterator> </tbody> </table> </div> </div> </s:form> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#add").click(function(){ $("form").attr("action","commodityClass_add"); $("form").attr("enctype","multipart/form-data"); $("form").submit(); }) $("#rew").click(function(){ $("form").attr("action","commodityClass_up"); $("form").attr("enctype","multipart/form-data"); $("form").submit(); }) }); </script> </body> </html>
商品列表视图:commoditylist.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>commodity list</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td,th{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class="span12"> <s:form theme="simple"> <input type="hidden" id="hiddenmyform"/> <input type="hidden" id="hiddenmethod"/> <div class="btn-group" > <a href="commodity_upadd" class="btn btn-small">添加</a> <button id="rew" class="btn btn-small">修改</button> <button id="del" class="btn btn-small">删除</button> <s:select name="ccsid" list="sccs" headerKey="0" headerValue="选择分类" listKey="id" listValue="name" value="0" onchange="getcommoditys(this)" /> </div> <table class="table table-condensed table-hover table-bordered"> <thead> <tr> <th> ID </th> <th> 编号 </th> <th> 名称 </th> <th> 商品 </th> <th> 价格 </th> <th> 链接 </th> <th> 添加时间 </th> <th> 修改时间 </th> <th> 状态 </th> </tr> </thead> <tbody id="show"> <s:iterator value="commoditys" > <tr> <td><s:checkbox label="id" name="upid" fieldValue="%{id}" value="false" /><s:property value="id"/></td> <td><s:property value="number" /></td> <td><s:property value="name"/></td> <td><img class="img-polaroid" alt="40*40" width="15%" src='<s:url value="/upload/%{path}" />' /></td> <td><s:property value="price" /></td> <td><s:property value="link" /></td> <td><s:date name="createDate" /></td> <td><s:date name="reworkDate" /></td> <td><s:if test="#state == 1"> 有效</s:if><s:else>无效</s:else></td> </tr> </s:iterator> </tbody> </table> </s:form> <s:set value="page" var="curr" /><!--起始页 --> <s:set value="totalPage" var="countPage"/><!-- 页码总数 --> <div class="pagination pagination-centered"> <ul> <li><a href="commodity_list?page=1">首页 </a></li> <li><a href='<s:if test="#curr > 1">commodity_list?page=<s:property value="#curr - 1" /></s:if><s:else>#</s:else>'>上一页 </a></li> <s:bean name="org.apache.struts2.util.Counter" id="counter"> <s:param name="first" value="startNum" /> <s:param name="last" value="endNum" /> <s:iterator> <li><a href='commodity_list?page=<s:property/>'><s:property/></a><li> </s:iterator> </s:bean> <li><a href='<s:if test="#curr < #countPage">commodity_list?page=<s:property value="#curr + 1" /></s:if><s:else>#</s:else>'>下一页 </a></li> <li><a href='commodity_list?page=<s:property value="#countPage" />'>尾页</a></li> </ul> </div> </div> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#rew").click(function(){ $("form").attr("action","commodity_addui"); $("form").submit(); }); $("#del").click(function(){ $("form").attr("action","commodity_del"); $("form").submit(); }); }); function getcommoditys(ele){ var csss = $(ele).val(); if(csss != 0){ $.ajax({ url:"getcommoditys", data:{'ccsid':csss}, success:function(data) { $("#show").empty(); for(var i=0; i<data.selectcs.length; i++) { $("#show").append("<tr><td>"+ data.selectcs[i].id+"</td><td>"+ data.selectcs[i].number+"</td><td>"+ data.selectcs[i].name+"</td><td>"+ '<img class="img-polaroid" alt="40*40" width="15%" src="upload/'+data.selectcs[i].path+'"'+'</td><td>'+ data.selectcs[i].price+"</td><td>"+ data.selectcs[i].link+"</td><td>"+ data.selectcs[i].createDate+"</td><td>"+ data.selectcs[i].reworkDate+"</td><td>"+ data.selectcs[i].state+"</td></tr>"); } }, error:function(xhr){alert('出错。。\n'+xhr.responseText);} }); }; }; </script> </body> </html>
商品添加视图:commodityinfo.jsp↓
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <s:set value="upcommodity" var="c" /> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>commodity info</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> <style type="text/css"> table td,th{word-break: keep-all;white-space:nowrap;} </style> </head> <body> <div class="contaniner-fluid"> <div class="row-fluid"> <s:form class="form-horizontal" theme="simple"> <div class="span6"> <!----> <input type="hidden" id="myf"/> <input type="hidden" id="met"/> <input type="hidden" name="commodity.id" value="%{#c.id}" /> <h4 class="brand"><s:if test="#c.id != unll ">修改商品</s:if><s:else>添加商品</s:else></h4> <div class="btn-CommodityClass_Entity" > <a href="commodity_list" class="btn">返回</a> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >商品ID <s:textfield placeholder="商品ID" name="commodity.number" value="%{#c.number}"/> </label> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >商品名称 <s:textfield placeholder="商品名称" name="commodity.name" value="%{#c.name}" /> </label> </div> </div> <div class="control-group"> <label class="control-label" for="text03">商品图片</label> <div class="controls"> <img class="img-polaroid" alt="160x120" width="30%" src='<s:url value="/upload/%{#c.path} "/>' /> <s:file class="input-file" placeholder="图片地址" size="100" name="pic" value=""/> </div> </div> <div class="control-group"> <label class="control-label" for="text04">商品价格</label> <div class="controls"> <s:textfield placeholder="商品价格" name="commodity.price" value="%{#c.price}"/> </div> </div> <div class="control-group"> <label class="control-label" for="text05">商品链接</label> <div class="controls"> <s:textfield placeholder="商品链接" size="100" name="commodity.link" value="%{#c.link}" /> </div> </div> <div class="control-group"> <div class="controls"> <label class="control-label" >状态 <s:select name="commodity.state" list="#{'1':'有效','2':'无效'}" headerKey="0" headerValue="请选择" value='%{#c.state}'/> </label> </div> </div> <div class="control-group"> <div class="controls"> <button <s:if test="#c.id != null">id="rew"</s:if><s:else>id="add"</s:else> class="btn"> <s:if test="#c.id != null">修改</s:if><s:else>添加</s:else> </button> </div> </div> </div> <div class="span6"> <!----> <h4>商品分类</h4> <div class="container-fluid" > <table class="table table-bordered table-striped" > <thead> <tr> <th>选择</th> <th>商品分类</th> <th>商品</th> </tr> </thead> <tbody> <s:iterator value="addCommodityclasss" id="co"> <tr> <td><s:radio list="%{#{id:id}}" name="commodity.commodityclass.id" value="%{#c.commodityclass.id}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path} "/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#co.getaLists()" id="ct"> <tr> <td><s:radio list="%{#{id:id}}" name="commodity.commodityclass.id" value="%{#c.commodityclass.id}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path} "/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#ct.getaLists()" id="cf"> <tr> <td><s:radio list="%{#{id:id}}" name="commodity.commodityclass.id" value="%{#c.commodityclass.id}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path} "/>'/> </div> </li> </ul> </td> </tr> <s:iterator value="#cf.getaLists()" > <tr> <td><s:radio list="%{#{id:id}}" name="commodity.commodityclass.id" value="%{#c.commodityclass.id}" /> </td> <td><s:property value="name" /></td> <td> <ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="holder.js/160x120" alt="160x120" src='<s:url value="/upload/%{path} "/>'/> </div> </li> </ul> </td> </tr> </s:iterator> </s:iterator> </s:iterator> </s:iterator> </tbody> </table> </div> </div> </s:form> </div> </div> <script src="bootstrap/js/jquery-1.10.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#add").click(function(){ $("form").attr("action","commodity_add"); $("form").attr("enctype","multipart/form-data"); $("form").submit(); }) $("#rew").click(function(){ $("form").attr("action","commodity_up"); $("form").attr("enctype","multipart/form-data"); $("form").submit(); }) }); </script> </body> </html>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。