寒假软件02
今天:实现了用户的登陆注册,展示
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h1>客户管理系统</h1><hr>
<a href="${pageContext.request.contextPath }/addCust.jsp">添加客户</a>
<a href="${pageContext.request.contextPath }/servlet/ListCustServlet">客户列表</a>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body style="text-align: center;"> <h1>客户管理系统_添加客户</h1><hr> <form action="${pageContext.request.contextPath }/servlet/AddCustServlet" method="POST"> <table border="1"> <tr> <td>客户姓名:</td> <td><input type="text" name="name" /></td> </tr> <tr> <td>客户性别:</td> <td> <input type="radio" name="gender" value="男" />男 <input type="radio" name="gender" value="女" />女 </td> </tr> <tr> <td>出生日期:</td> <td><input type="text" name="birthday" /></td> </tr> <tr> <td>手机号码:</td> <td><input type="text" name="cellphone" /></td> </tr> <tr> <td>电子邮箱:</td> <td><input type="text" name="email" /></td> </tr> <tr> <td>客户爱好:</td> <td> <input type="checkbox" name="preference" value="篮球" />篮球 <input type="checkbox" name="preference" value="乒乓球" />乒乓球 <input type="checkbox" name="preference" value="玻璃球" />玻璃球 <input type="checkbox" name="preference" value="铅球" />铅球 </td> </tr> <tr> <td>客户类型:</td> <td> <select name="type"> <option value="钻石客户">钻石客户</option> <option value="白金客户">白金客户</option> <option value="黄金客户">黄金客户</option> <option value="白银客户">白银客户</option> <option value="青铜客户">青铜客户</option> <option value="黑铁客户">黑铁客户</option> <option value="没牌客户">没牌客户</option> </select> </td> </tr> <tr> <td>描述信息:</td> <td><textarea name="description" rows="6" cols="40" ></textarea></td> </tr> <tr> <td colspan="2"> <input type="submit" value="添加客户"/> </td> </tr> </table> </form> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script type="text/javascript"> function checkAll(allC){ var otherCs = document.getElementsByName("delId"); for(var i=0;i<otherCs.length;i++){ otherCs[i].checked = allC.checked; } } </script> </head> <body style="text-align: center;"> <h1>客户列表页面</h1><hr> <form action="${pageContext.request.contextPath}/servlet/BatchDelServlet" method="POST"> <table border="1" width="100%"> <tr> <th><input type="checkbox" onclick="checkAll(this)"/>全选</th> <th>客户姓名</th> <th>客户性别</th> <th>出生日期</th> <th>手机号码</th> <th>电子邮箱</th> <th>客户爱好</th> <th>客户类型</th> <th>描述信息</th> <th>修改</th> <th>删除</th> </tr> <c:forEach items="${requestScope.list}" var="cust"> <tr> <td><input type="checkbox" name="delId" value="${cust.id }" /></td> <td><c:out value="${cust.name }"/></td> <td><c:out value="${cust.gender }"/></td> <td><c:out value="${cust.birthday }"/></td> <td><c:out value="${cust.cellphone }"/></td> <td><c:out value="${cust.email }"/></td> <td><c:out value="${cust.preference }"/></td> <td><c:out value="${cust.type }"/></td> <td><c:out value="${cust.description }"/></td> <td><a href="${pageContext.request.contextPath }/servlet/CustInfoServlet?id=${cust.id }">修改</a></td> <td><a href="${pageContext.request.contextPath }/servlet/DelCustServlet?id=${cust.id }">删除</a></td> </tr> </c:forEach> </table> <input type="submit" value="批量删除"/> </form> </body> </html>
import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.itheima.domain.Cust; import com.itheima.factory.BasicFactory; import com.itheima.service.CustService; public class ListCustServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CustService service = BasicFactory.getFactory().getInstance(CustService.class); List<Cust> list = service.getAllCust(); request.setAttribute("list", list); request.getRequestDispatcher("/listCust.jsp").forward(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
明天:实现用户的增加,查询,修改
问题:无
浙公网安备 33010602011771号