<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      賈云鵬

      jsp第十三周作業(yè)

      1.第十二周上機作業(yè)(郵件功能)的控制層代碼改用為servlet實現(xiàn)。
      package com.jyp.dao;
      
      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.util.List;
      
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.sql.DataSource;
      
      public class BaseDao {
      
      
          //獲取連接
          protected Connection getConnection(){
              Connection conn=null;
                  try {
                      Class.forName("com.mysql.jdbc.Driver");
                      // 2.建立連接
                      conn = DriverManager.getConnection(
                              "jdbc:mysql://localhost:3306/test", "root", "123456");
                  } catch (Exception e) {
                      e.printStackTrace();
                  } 
                  return conn;
          }    
          
          
          //關(guān)閉連接
          protected void closeAll(Connection con,PreparedStatement ps,ResultSet rs){        
          try {
              if(rs != null)
                  rs.close();
              if(ps != null)
                  ps.close();
              if(con != null)
                  con.close();
              
              } catch (SQLException e) {
                  e.printStackTrace();
              }
          }
          
      }
      package com.jyp.dao;
      
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;
      
      import com.jyp.entity.Msg;
      
      public class MsgDao extends BaseDao {
          // 1,插入郵件
          public void addMsg(Msg m) {
              Connection con = getConnection();
              String sql = "insert into msg(username,title,msgcontent,state,sendto,msg_create_date) values(?,?,?,?,?,?)";
              PreparedStatement ps = null;
              try {
                  ps = con.prepareStatement(sql);
                  ps.setString(1, m.getUsername());
                  ps.setString(2, m.getTitle());
                  ps.setString(3, m.getMsgcontent());
                  ps.setInt(4, 1);
                  ps.setString(5, m.getSendto());
                  ps.setDate(6, new java.sql.Date(new Date().getTime()));// 系統(tǒng)當前時間
                  ps.executeUpdate();
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } finally {
                  closeAll(con, ps, null);
              }
      
          }
      
          // 2.刪除郵件
          public void delMail(int id) {
              Connection conn = getConnection();
              String sql = "delete from msg where msgid=?";
              PreparedStatement ps = null;
              try {
                  ps = conn.prepareStatement(sql);
                  ps.setInt(1, id);
                  ps.executeUpdate();
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }finally{
                  closeAll(conn, ps, null);
              }
      
          }
           //(測試刪除郵件的代碼是否編寫成功)
           //    public static void main(String[] args) {
           //    MsgDao md=new MsgDao();
          //    md.delMail(3);
          //}
      
      
          // 3.修改郵件狀態(tài)
          public void update(int id) {
              Connection con = getConnection();
              String sql = "update  msg set state='1' where msgid=?";
              PreparedStatement ps = null;
              try {
                  ps = con.prepareStatement(sql);
                  ps.setInt(1, id);
                  ps.executeUpdate();
              } catch (SQLException e) {
                  e.printStackTrace();
              } finally {
                  closeAll(con, ps, null);
              }
          }
      
          // 4.按照接收者查詢?nèi)苦]件
          public List<Msg> getMailByReceiver(String name) {
              List<Msg> list = new ArrayList<Msg>();
              Connection con = getConnection();
              String sql = "select * from msg where sendto=?";
              PreparedStatement ps=null;
              ResultSet rs=null;
              try {
                  ps = con.prepareStatement(sql);
                  ps.setString(1, name);
                  rs = ps.executeQuery();
                  while (rs.next()) {
                      Msg m = new Msg();
                      m.setMsgid(rs.getInt("msgid"));
                      m.setUsername(rs.getString("username"));
                      m.setTitle(rs.getString("title"));
                      m.setMsgcontent(rs.getString("msgcontent"));
                      m.setState(rs.getInt("state"));
                      m.setSendto(rs.getString("sendto"));
                      m.setMsg_create_date(rs.getDate("msg_create_date"));
                      list.add(m);
                  }
              } catch (SQLException e) {
                  e.printStackTrace();
              }finally{
                  closeAll(con, ps, rs);
              }
              return list;
      
          }
          //5.實現(xiàn)閱讀郵件功能
          public Msg read(int id) {
              Connection con = getConnection();
              String sql = "select msgid,username,sendto,title,msgcontent,msg_create_date from msg where msgid=?";
              PreparedStatement ps = null;
              ResultSet rs = null;
              try {
                  ps = con.prepareStatement(sql);
                  ps.setInt(1, id);
                  rs = ps.executeQuery();
                  while (rs.next()) {
                      Msg m = new Msg();
                      m.setMsgid(rs.getInt("msgid"));
                      m.setUsername(rs.getString("username"));
                      m.setTitle(rs.getString("title"));
                      m.setMsgcontent(rs.getString("msgcontent"));
                      m.setSendto(rs.getString("sendto"));
                      m.setMsg_create_date(rs.getDate("msg_create_date"));
                      return m;
                  }
      
              } catch (SQLException e) {
                  e.printStackTrace();
              } finally {
                  closeAll(con, ps, rs);
              }
              return null;
          }
      
      
      }
      package com.jyp.dao;
      
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      
      import com.jyp.entity.Users;
      
      public class UsersDao extends BaseDao {
      
          // 關(guān)于用戶的增刪改查
      
          // 1.登錄
          public boolean login(String uname, String upwd) {
              boolean f = false;
              Connection con = getConnection();
              String sql = "select * from users where uname=? and upwd=?";
              PreparedStatement ps = null;
              ResultSet rs = null;
              try {
                  ps = con.prepareStatement(sql);
                  ps.setString(1, uname);
                  ps.setString(2, upwd);
                  rs = ps.executeQuery();
                  if (rs.next())
                      f = true;
              } catch (SQLException e) {
                  e.printStackTrace();
              } finally {
                  closeAll(con, ps, rs);
              }
              return f;
          }
      
          // 2.注冊
          public int register(String uname, String upwd) {
              Connection con = getConnection();
              PreparedStatement ps = null;
              int x = 0;
              try {
                  String sql = "insert into users(uname,upwd) values(?,?)";
                  ps = con.prepareStatement(sql);
                  ps.setString(1, uname);
                  ps.setString(2, upwd);
                  x = ps.executeUpdate();
              } catch (SQLException e) {
                  e.printStackTrace();
              } finally {
                  closeAll(con, ps, null);
              }
              return x;
          }
      }
      package com.jyp.entity;
      
      import java.util.Date;
      
      public class Msg {
          private int msgid;
          private String username;
          private String title;
          private String msgcontent;
          private int state;
          private String sendto;
          private Date msg_create_date;
          public int getMsgid() {
              return msgid;
          }
          public void setMsgid(int msgid) {
              this.msgid = msgid;
          }
          public String getUsername() {
              return username;
          }
          public void setUsername(String username) {
              this.username = username;
          }
          public String getTitle() {
              return title;
          }
          public void setTitle(String title) {
              this.title = title;
          }
          public String getMsgcontent() {
              return msgcontent;
          }
          public void setMsgcontent(String msgcontent) {
              this.msgcontent = msgcontent;
          }
          public int getState() {
              return state;
          }
          public void setState(int state) {
              this.state = state;
          }
          public String getSendto() {
              return sendto;
          }
          public void setSendto(String sendto) {
              this.sendto = sendto;
          }
          public Date getMsg_create_date() {
              return msg_create_date;
          }
          public void setMsg_create_date(Date msg_create_date) {
              this.msg_create_date = msg_create_date;
          }
          
          
          
      }
      package com.jyp.entity;
      
      public class Users {
          int id;
          String uname;
          String upwd;
          public int getId() {
              return id;
          }
          public void setId(int id) {
              this.id = id;
          }
          public String getUname() {
              return uname;
          }
          public void setUname(String uname) {
              this.uname = uname;
          }
          public String getUpwd() {
              return upwd;
          }
          public void setUpwd(String upwd) {
              this.upwd = upwd;
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.jms.Session;
      import javax.servlet.ServletException;
      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import javax.servlet.http.HttpSession;
      
      import com.jyp.dao.UsersDao;
      import com.jyp.entity.Users;
      
      
      
      @WebServlet("/dologin.do")
      public class DoLogin extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public DoLogin() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           * 
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request
           *            the request send by the client to the server
           * @param response
           *            the response send by the server to the client
           * @throws ServletException
           *             if an error occurred
           * @throws IOException
           *             if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              doPost(request, response);
          }
      
          /**
           * The doPost method of the servlet. <br>
           * 
           * This method is called when a form has its tag value method equals to
           * post.
           * 
           * @param request
           *            the request send by the client to the server
           * @param response
           *            the response send by the server to the client
           * @throws ServletException
           *             if an error occurred
           * @throws IOException
           *             if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              response.setContentType("text/html,charset=utf-8");
              request.setCharacterEncoding("utf-8");
              response.setCharacterEncoding("utf-8");
              String uname = request.getParameter("uname");
              String password = request.getParameter("password");
              Users ud = new Users();
              HttpSession session = request.getSession();
              PrintWriter out = response.getWriter();
              if (ud.Login(uname, password)) {
                  session.setAttribute("uname", uname);
                  request.getRequestDispatcher("index.jsp").forward(request, response);
              } else {
                  out.print("登錄失敗,即將調(diào)回登錄頁.....");
                  response.setHeader("refresh", "2;url=login.jsp");
              }
          }
      
          /**
           * Initialization of the servlet. <br>
           * 
           * @throws ServletException
           *             if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import com.jyp.dao.UsersDao;
      
      public class DoRegister extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public DoRegister() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              doPost(request, response);
          }
      
          /**
           * The doPost method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to post.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              response.setContentType("text/html,charset=utf-8");
              PrintWriter out = response.getWriter();
              
              request.setCharacterEncoding("utf-8");
              String uname = request.getParameter("uname");
              String upwd = request.getParameter("upwd");
              String rupwd = request.getParameter("rupwd");
              if (upwd.equals(rupwd)) {
                  UsersDao ud = new UsersDao();
                  ud.register(uname, upwd);
                  out.print("注冊成功5秒返回登錄頁?。。?);
                  response.setHeader("refresh", "5;url=login.jsp");
              } else {
                  out.print("兩次密碼不一致,5秒后跳回注冊頁?。。?);
                  response.setHeader("refresh", "5;url=zc.jsp");
              }
          }
      
          /**
           * Initialization of the servlet. <br>
           *
           * @throws ServletException if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.servlet.ServletException;
      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import javax.servlet.http.HttpSession;
      
      import com.jyp.entity.email;
      import com.jyp.dao.emailDao;
      
      @WebServlet("/dolook.do")
      public class DoLook extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public DoLook() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           * 
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request
           *            the request send by the client to the server
           * @param response
           *            the response send by the server to the client
           * @throws ServletException
           *             if an error occurred
           * @throws IOException
           *             if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              doPost(request, response);
          }
      
          /**
           * The doPost method of the servlet. <br>
           * 
           * This method is called when a form has its tag value method equals to
           * post.
           * 
           * @param request
           *            the request send by the client to the server
           * @param response
           *            the response send by the server to the client
           * @throws ServletException
           *             if an error occurred
           * @throws IOException
           *             if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              response.setContentType("text/html,charset=utf-8");
              request.setCharacterEncoding("utf-8");
              response.setCharacterEncoding("utf-8");
              String id = request.getParameter("id");
              int idd = Integer.parseInt(id);
              emailDao e = new emailDao();
              e.update(idd);
              email email = e.look(idd);
              HttpSession session=request.getSession();
              session.setAttribute("email", email);
              request.getRequestDispatcher("look.jsp").forward(request, response);
          }
      
          /**
           * Initialization of the servlet. <br>
           * 
           * @throws ServletException
           *             if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.servlet.ServletException;
      import javax.servlet.annotation.WebServlet;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      @WebServlet("/dodel.do")
      public class DoDel extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public DoDel() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              doPost(request, response);
      
      
          }
      
          /**
           * The doPost method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to post.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              response.setContentType("text/html,charset=utf-8");
              request.setCharacterEncoding("utf-8");
              response.setCharacterEncoding("utf-8");
      
              com.jyp.dao.emailDao e=new com.jyp.dao.emailDao();
              String id=request.getParameter("id");
              int idd=Integer.parseInt(id);
              e.del(idd);
              request.getRequestDispatcher("main.jsp").forward(request, response);
          }
      
          /**
           * Initialization of the servlet. <br>
           *
           * @throws ServletException if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import javax.servlet.http.HttpSession;
      
      import com.jyp.dao.emailDao;
      import com.jyp.entity.email;
      
      public class DoWrite extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public DoWrite() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              doPost(request, response);
          }
      
          /**
           * The doPost method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to post.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              response.setContentType("text/html,charset=utf-8");
              PrintWriter out = response.getWriter();
              HttpSession session=request .getSession();
              request.setCharacterEncoding("utf-8");
              String address=(String)session.getAttribute("uname");
              String receiver=request.getParameter("receiver");
              String title=request.getParameter("title");
              String contents=request.getParameter("contents");
              email  e=new email();
              e.setAddress(address);
              e.setReceiver(receiver);
              e.setTitle(title);
              e.setContents(contents);
              emailDao ed=new emailDao();
              ed.addEmail(e);
              out.print("發(fā)送成功,3秒后跳回首頁?。?!");
              response.setHeader("refresh", "3;url=main.jsp");
          }
      
          /**
           * Initialization of the servlet. <br>
           *
           * @throws ServletException if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      package com.servlet;
      
      import java.io.IOException;
      import java.io.PrintWriter;
      
      import javax.servlet.ServletException;
      import javax.servlet.http.HttpServlet;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import com.jyp.dao.emailDao;
      import com.jyp.entity.email;
      
      public class Detail extends HttpServlet {
      
          /**
           * Constructor of the object.
           */
          public Detail() {
              super();
          }
      
          /**
           * Destruction of the servlet. <br>
           */
          public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
              // Put your code here
          }
      
          /**
           * The doGet method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to get.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              doPost(request, response);
          }
      
          /**
           * The doPost method of the servlet. <br>
           *
           * This method is called when a form has its tag value method equals to post.
           * 
           * @param request the request send by the client to the server
           * @param response the response send by the server to the client
           * @throws ServletException if an error occurred
           * @throws IOException if an error occurred
           */
          public void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
      
              response.setContentType("text/html;charset=utf-8");
              PrintWriter out = response.getWriter();
              
              String id=request.getParameter("id");
              int uid=Integer.parseInt(id);
              emailDao ed=new emailDao();
              ed.update(uid);
              email  e=ed.lookEmail(uid);
          }
      
          /**
           * Initialization of the servlet. <br>
           *
           * @throws ServletException if an error occurs
           */
          public void init() throws ServletException {
              // Put your code here
          }
      
      }
      <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
        <head>
          <base href="<%=basePath%>">
          
          <title>My JSP 'denglu.jsp' starting page</title>
          
          <meta http-equiv="pragma" content="no-cache">
          <meta http-equiv="cache-control" content="no-cache">
          <meta http-equiv="expires" content="0">    
          <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
          <meta http-equiv="description" content="This is my page">
          <!--
          <link rel="stylesheet" type="text/css" href="styles.css">
          -->
      
        </head>
        
        <body>
         <script type="text/javascript">
              function validate(){
                  if(loginForm.uname.value==""){
                      alert("賬號不能為空!");
                      return;
                  }
                  if(loginForm.upwd.value==""){
                      alert("密碼不能為空!");
                      return;
                  }
                  loginForm.submit();
              }
          </script>
      
      
          <form name="loginForm" action="dologin.jsp" method="post">
              
          用戶名:<input type="text" name="uname" value="zs"><br> 
          密碼: <input  type="password" name="upwd"  value="zs">
          
              <input type="button" value="登錄" onClick="validate()">    
      
      
      
      
      
          </form>
      
      <a href="reg.jsp">立即注冊</a>
      
      
        </body>
      </html>
      <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      <%@page import="com.jyp.entity.Msg"%>
      <%@page import="com.jyp.dao.MsgDao"%>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
        <head>
          <base href="<%=basePath%>">
          
          <title>My JSP 'main.jsp' starting page</title>
          
          <meta http-equiv="pragma" content="no-cache">
          <meta http-equiv="cache-control" content="no-cache">
          <meta http-equiv="expires" content="0">    
          <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
          <meta http-equiv="description" content="This is my page">
          <!--
          <link rel="stylesheet" type="text/css" href="styles.css">
          -->
      
        </head>
      
      <body>
          <%
              MsgDao md = new MsgDao();
              String uname = (String) session.getAttribute("uname");
              List<Msg> list = md.getMailByReceiver(uname);
          %>
          歡迎你<%=uname%>
          <a href="write.jsp">寫郵件</a>
      
          <table border="1">
              <tr>
                  <td>發(fā)件人</td>
                  <td>主題</td>
                  <td>狀態(tài)</td>
                  <td>時間</td>
                  <td>操作</td>
                  <td>操作</td>
              </tr>
      
              <%
                  for (int i = 0; i < list.size(); i++) {
              %>
              <tr>
                  <td><%=list.get(i).getUsername()%></td>
                  <td><%=list.get(i).getTitle()%></td>
                  <td>
                      <%
                          if (list.get(i).getState() == 1) {
                      %> <img src="images/sms_unReaded.png" />
                      <%
                          } else {
                      %> <img src="images/sms_readed.png" /> <%
           }
       %>
                  </td>
                  <td><%=list.get(i).getMsg_create_date()%></td>
                  <td><a href="write.jsp?reply=<%=list.get(i).getUsername()%>">回復</a>
                  </td>
                  <td><a href="del.jsp?id=<%=list.get(i).getMsgid()%>">刪除</a>
                  </td>
              </tr>
              <%} %>
          </table>
      
      
      </body>
      </html>
      <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
        <head>
          <base href="<%=basePath%>">
          
          <title>My JSP 'write.jsp' starting page</title>
          
        </head>
        
        <body>
          <form action="dowrite.jsp" method="post">
              
          收件人:<input type="text" name="sendto" value="<%=request.getParameter("reply") %>"><br> 
          主題: <input  type="text" name="title" ><br>
          內(nèi)容    <textarea rows="6" cols="20" name="content"></textarea>
      <br>
      <input type="submit" value="發(fā)送"> 
      
      
      
          </form>
        </body>
      </html>
      <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
        <head>
          <base href="<%=basePath%>">
        </head>
        
        <body>
          <script type="text/javascript">
                  function dozhuce(){
                      if(loginform2.id.value==""){
                          alert("沒有輸入id");
                          return;
                      }
                      if(loginform2.uname.value==""){
                          alert("沒有輸入用戶名");
                          return;
                      }
                      if(loginform2.upwd.value==""){
                          alert("沒有輸入密碼");
                          return;
                      }
                      if(loginform2.upwd2.value==""){
                          alert("沒有確認密碼");
                          return;
                      }
                      loginform2.submit();
                  }
              </script>
          <form action="doregister.jsp" name="loginform2" method="post">
              id: <input type="number" name="id"/>
              用戶名:<input type="text" value="zs" name="uname"/>
              密碼:<input type="password" value="11" name="upwd"/>
              確認密碼:<input type="password" value="11" name="upwd2"/>
              <input type="button" value="注冊" onclick="dozhuce()"/>
              </form>
        </body>
      </html>
      <%@page import="com.jyp.entity.Msg"%>
      <%@page import="com.jyp.dao.MsgDao"%>
      <%@page import="com.jyp.dao.UsersDao"%>
      <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
      <%
          request.setCharacterEncoding("utf-8");
          
          String uname=(String)session.getAttribute("uname");// 發(fā)件人在session中獲取
          String sendto=request.getParameter("sendto");
          String title=request.getParameter("title");
          String content=request.getParameter("content");
          
          Msg m=new Msg();
          m.setTitle(title);
          m.setMsgcontent(content);
          m.setUsername(uname);
          m.setSendto(sendto);
          
          MsgDao md=new MsgDao();
          md.addMsg(m);
          
          out.print("發(fā)送成功,即將跳回首頁.....");
          response.setHeader("refresh", "3;url=main.jsp");
          
              
          
          
      
       %>

       

      posted on 2022-05-29 16:30  賈云鵬  閱讀(16)  評論(0)    收藏  舉報

      導航

      主站蜘蛛池模板: 久久人人爽人人爽人人av| 欧美大胆老熟妇乱子伦视频| 日本55丰满熟妇厨房伦| 麻豆成人精品国产免费| 一区二区三区四区高清自拍| 国产精品一线二线三线区| 亚洲成a人片在线视频| 吉川爱美一区二区三区视频 | bt天堂新版中文在线| 久久zyz资源站无码中文动漫| 国产成人a在线观看视频免费| 色综合久久人妻精品日韩| 色欲综合久久中文字幕网| 国产一区二区黄色激情片| 中文字幕av无码免费一区| 精品国产迷系列在线观看| 利川市| 国产一区二区三区内射高清| 天天拍夜夜添久久精品大| 国产激情艳情在线看视频| 一区二区三区国产亚洲自拍 | 国产欧美另类久久久精品丝瓜| 亚洲综合色区另类av| 中文字幕理伦午夜福利片| 嗯灬啊灬把腿张开灬动态图| 久章草这里只有精品| 亚洲ΑV久久久噜噜噜噜噜| 人妻精品动漫H无码中字| 超碰成人人人做人人爽| 色av综合av综合无码网站| 91精品国产蜜臀在线观看| 自拍日韩亚洲一区在线| 国内久久人妻风流av免费| 亚洲精品人成网线在播放VA| 亚洲成av人片在www鸭子| 亚洲第一区二区三区av| 丰满熟女人妻一区二区三| 日韩精品中文字幕国产一| 日本熟妇hdsex视频| 国产精品香港三级国产av| 日韩亚洲精品中文字幕|