• 2020.11.23收获


    update.jsp
     
    <%@page import="com.jaovo.msg.model.User"%>
    <%@page import="com.jaovo.msg.Util.DaoFactory"%>
    <%@page import="com.jaovo.msg.dao.IUserDao"%>
    <%@page import="com.jaovo.msg.Util.ValidateUtil"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
     //获取客户端传递过来的参数
     int id = Integer.parseInt(request.getParameter("id"));
     String time = request.getParameter("time");
     String jieci = request.getParameter("jieci");
     String college = request.getParameter("college");
     String tid = request.getParameter("tid");
     String tname = request.getParameter("tname");
     String number = request.getParameter("number");
     
     boolean validate = ValidateUtil.validateNull(request, new String[]{"age","major"});
     if(!validate){
    %> 
     <jsp:forward page="updateInput.jsp"></jsp:forward> 
    <%
     }
     IUserDao userDao = DaoFactory.getDaoImpl();
     User user = userDao.load(id);
     
     user.setTime(time);
     user.setJieci(jieci);
     user.setCollege(college);
     user.setTid(tid);
     user.setTname(tname);
     user.setNumber(number);
     
     userDao.update(user);
     
     response.sendRedirect("index.jsp");
    %>
     
    updateInput.jsp
     
    <%@page import="com.jaovo.msg.Util.ValidateUtil"%>
    <%@page import="com.jaovo.msg.model.User"%>
    <%@page import="com.jaovo.msg.Util.DaoFactory"%>
    <%@page import="com.jaovo.msg.dao.IUserDao"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>用户修改页面</title>
    </head>
    <body>
     <%
      //获取客户端传递过来的参数
      int id = Integer.parseInt(request.getParameter("id"));
      IUserDao userDao = DaoFactory.getDaoImpl();
      User user = userDao.load(id);
     %>
     <form action="update.jsp" method="get">
      <table align="center" border="1" width="500">
       <input type="hidden" name="id" value="<%=user.getId() %>" />
       <tr>
        <td>课程名称 : </td>
        <td>
         <input type="text" name="name" value="<%=user.getName() %>" />
         <%=ValidateUtil.showError(request, "name") %>
        </td>
       </tr>
        <tr>
           <td>开课时间:</td>
           <td>
            <input type="text" name="time" value="<%=user.getTime() %>" />
            <%=ValidateUtil.showError(request, "time") %>
           </td>
          <tr>
        <td>开课节次 : </td>
        <td>
         <input type="text" name="jieci" value="<%=user.getJieci() %>" />
         <%=ValidateUtil.showError(request, "jieci") %>
        </td>
       </tr>
       <tr>
        <td>所属学院 : </td>
        <td>
         <input type="text" name="college" value="<%=user.getCollege() %>" />
         <%=ValidateUtil.showError(request, "college") %>
        </td>
       </tr>
       <tr>
        <td>教师工号 : </td>
        <td>
         <input type="text" name="tid" value="<%=user.getTid() %>" />
         <%=ValidateUtil.showError(request, "tid") %>
        </td>
       </tr>
       <tr>
        <td>教师姓名 : </td>
        <td>
         <input type="text" name="tname" value="<%=user.getTname() %>" />
         <%=ValidateUtil.showError(request, "tname") %>
        </td>
       </tr>
       <tr>
        <td>限制人数 : </td>
        <td>
         <input type="text" name="number" value="<%=user.getNumber() %>" />
         <%=ValidateUtil.showError(request, "number") %>
        </td>
       </tr>
          <tr align="center">
           <td colspan="2">
            <input type="submit" value="提交" />
            <input type="reset" value="重置" />
           </td>
          </tr>
      </table>
     </form>
    </body>
    </html>
  • 相关阅读:
    SDC是如何炼成的?Exception篇
    数字IC后端时钟树综合专题(OCC电路案例一)
    DDR接口时序实例
    SDC是如何炼成的?IO约束篇
    10个免费的响应式jQuery Carousel 轮播图插件
    为Web程序员准备的10个最棒的jQuery视频插件
    10种优化页面加载速度的方法
    人人必知的10个 jQuery 小技巧
    css3 旋转 过渡 实例
    css3 学习
  • 原文地址:https://www.cnblogs.com/ltw222/p/14067720.html
Copyright © 2020-2023  润新知