发表于: 2018-03-22 19:51:59

1 551


今天完成的事情:(一定要写非常细致的内容,比如说学会了盒子模型,了解了Margin) 

对同一url进行不同方法操作时,不太明白jsp写法。

师兄提醒是用form表单

<%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!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>学员列表</title>
</head>
<body>
<c:if test="${empty requestScope.student}">
没有任何用户信息!
</c:if>
<c:if test="${!empty requestScope.student}">
学员列表:
   <%--<a href="${pageContext.request.contextPath}/student/newOne">新增学员</a>--%>
   <form method="GET" action="${pageContext.request.contextPath}/student/newOne">
       <input type="submit" value="新增学员信息"/></form>
   <form action="${pageContext.request.contextPath}/student/list" method="get">
       <table border="1" cellpadding="10" cellspacing="0" class="table1">
           <tr>
               <th>学员ID</th>
               <th>姓名</th>
               <th>性别</th>
               <th>年龄</th>
               <th>QQ</th>
               <th>修真类型</th>
               <th>加入时间</th>
               <th>学校</th>
               <th>线上学号</th>
               <th>日报链接</th>
               <th>立愿</th>
               <th>辅导师兄</th>
               <th>修改信息</th>
               <th>删除信息</th>
           </tr>
           <c:forEach items="${requestScope.student.lists}" var="student">
<tr>
                   <th>${student.id}</th>
                   <th>${student.name}</th>
                   <th>${student.gender}</th>
                   <th>${student.age}</th>
                   <th>${student.qq}</th>
                   <th>${student.occupation}</th>
                   <th>${student.joinDate}</th>
                   <th>${student.school}</th>
                   <th>${student.number}</th>
                   <th>${student.dailyUrl}</th>
                   <th>${student.declaration}</th>
                   <th>${student.consoler}</th>
                   <th><a href="${pageContext.request.contextPath}/student/edit">修改</a></th>
                   <th><form action="/student/${student.id}" method="POST" >删除</form></th>
               </tr>
           </c:forEach>
</table>
   </form>
</c:if>
<table border="0" cellspacing="0" cellpadding="0" width="900px">
   <tr>
       <td class="td2">
           <span>${requestScope.student.currPage}/ ${requestScope.student.totalPage}</span>&nbsp;&nbsp;
           <span>总记录数:${requestScope.student.totalCount }&nbsp;&nbsp;每页显示:${requestScope.student.pageSize}</span>&nbsp;&nbsp;
           <span>
      <c:if test="${requestScope.student.currPage != 1}">
<a href="${pageContext.request.contextPath }/student/list?currentPage=1">[首页]</a>&nbsp;&nbsp;
          <a href="${pageContext.request.contextPath }/student/list?currentPage=${requestScope.student.currPage-1}">[上一页]</a>&nbsp;&nbsp;
      </c:if>

<c:if test="${requestScope.student.currPage != requestScope.student.totalPage}">
<a href="${pageContext.request.contextPath }/student/list?currentPage=${requestScope.student.currPage+1}">[下一页]</a>&nbsp;&nbsp;
          <a href="${pageContext.request.contextPath }/student/list?currentPage=${requestScope.student.totalPage}">[尾页]</a>&nbsp;&nbsp;
      </c:if>
</span>
       </td>
   </tr>
</table>
<table>

</table>

</body>

</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"

        pageEncoding="UTF-8" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>

<html>
<head>
   <title>添加学生</title>
</head>
<body>
<form method="POST" action="${pageContext.request.contextPath}/student/edit">
   <table border="1" cellpadding="10" cellspacing="0" class="table1">
       <tr>
           <th>姓名</th>
           <th>性别</th>
           <th>年龄</th>
           <th>QQ</th>
           <th>修真类型</th>
           <th>加入时间</th>
           <th>学校</th>
           <th>线上学号</th>
           <th>日报链接</th>
           <th>立愿</th>
           <th>辅导师兄</th>
       </tr>
       <tr>
           <th><label>
               <input type="text" name="name" value="">
           </label></th>
           <th><label>
               <input type="text" name="gender" value="">
           </label></th>
           <th><label>
               <input type="text" name="age" value="">
           </label></th>
           <th><label>
               <input type="text" name="qq" value="">
           </label></th>
           <th><label>
               <input type="text" name="occupation" value="">
           </label></th>
           <th><label>
               <input type="text" name="joinDate" value="">
           </label></th>
           <th><label>
               <input type="text" name="school" value="">
           </label></th>
           <th><label>
               <input type="text" name="number" value="">
           </label></th>
           <th><label>
               <input type="text" name="dailyUrl" value="">
           </label></th>
           <th><label>
               <input type="text" name="declaration" value="">
           </label></th>
           <th><label>
               <input type="text" name="consoler" value="">
           </label></th>
       </tr>
       <tr>
           <th><input type="submit"></th>
       </tr>
   </table>
</form>
<form action="${pageContext.request.contextPath}/student/list" method="GET">
   <input type="submit" value="返回主页"></form>

</body>
</html>

jetty一开始报错,方法没写对

后来就能正常添加了

还有两个查询和一个删除

删除在form中没有delete方法,需要用其他方式。
明天计划的事情:(一定要写非常细致的内容) 

页面上的crud初步做完

参数检验做一下
遇到的问题:(遇到什么困难,怎么解决的)

jsp里的delete 
收获:(通过今天的学习,学到了什么知识)

form表单的很多用法之一,指定方法。


返回列表 返回列表
评论

    分享到