zoukankan      html  css  js  c++  java
  • JSP ——第八次作业

    package com.entity;
    
    import java.sql.Date;
    
    public class Msg {
        int msgid;
        String usernname;
        String title;
        String msgcontent;
        int state;
        String sendto;
        String msg_create_date;
        public int getMsgid() {
            return msgid;
        }
        public void setMsgid(int msgid) {
            this.msgid = msgid;
        }
        public String getUsernname() {
            return usernname;
        }
        public void setUsernname(String usernname) {
            this.usernname = usernname;
        }
        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 String getMsg_create_date() {
            return msg_create_date;
        }
        public void setMsg_create_date(Date date) {
            this.msg_create_date = msg_create_date;
        }
    
    }
    package com.entity;
    
    public class Users {
        String username;
        String password;
        String email;
        public String getUsername() {
            return username;
        }
        public void setUsername(String username) {
            this.username = username;
        }
        public String getPassword() {
            return password;
        }
        public void setPassword(String password) {
            this.password = password;
        }
        public String getEmail() {
            return email;
        }
        public void setEmail(String email) {
            this.email = email;
        }
    
    }
    

      

    <%@page import="com.gd.entity.Msg"%>
    <%@page import="com.gd.dao.MsgDao"%>
    <%@ page language="java" contentType="text/html; charset=utf-8"
        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" "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>
    </head>
    <body>
        <%
            int id = Integer.parseInt(request.getParameter("id"));
            MsgDao md = new MsgDao();
            Msg m = md.getMailById(id);
        %>
        <p>
            题目:<%=m.getTitle()%></p>
        <p>
            来自:<%=m.getUsernname()%></p>
        <p>
            时间:<%=m.getMsg_create_date()%></p>
        <p>
            内容:<%=m.getMsgcontent()%></p>
    回复   <a href="main.jsp">返回</a>
    </body>
    </html>
    

      

    <%@page import="com.gd.entity.Users"%>
    <%@page import="com.gd.dao.UsersDao"%>
    <%@ 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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Insert title here</title>
    </head>
    <%
        request.setCharacterEncoding("utf-8");
        String uname = request.getParameter("uname");
        String upwd = request.getParameter("upwd");
        UsersDao ud = new UsersDao();
        if (ud.login(uname, upwd)){
            //登陆成功 创建User页面,并放入session
            Users u=new Users();
            u.setUsername(uname);
            u.setPassword(upwd);
            session.setAttribute("user", u);
            request.getRequestDispatcher("main.jsp").forward(request, response);
            }
        else
            response.sendRedirect("index.jsp");
    %>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=utf-8"
        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" "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>
    </head>
    <body>
       <form action="dologin.jsp" method="post">
    用户名:<input type="text" name="uname" value="kitty" /><Br>
    密码 :<input type="password" name="upwd" value="777"/><br>
    
    <input type="submit" value="登录">
    
    </form>
      </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
        <%@page import="java.sql.SQLException"%>
        
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="com.gd.dao.MsgDao"%>
    <%@page import="com.gd.entity.Users"%>
    <%@page import="java.util.List"%>
    <%@page import="com.gd.dao.BaseDao"%>
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="java.sql.DriverManager"%>
    <%@page import="java.sql.PreparedStatement"%>
    <%@page import="java.sql.ResultSet"%>
    <%@page import="java.sql.Connection"%>
    
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
    %>
    <!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>
    </head>
    <body>
        欢迎页面!!!欢迎你!!!<%
        Users u = (Users) session.getAttribute("user");
        out.print(u.getUsername());
        MsgDao md=new MsgDao();
        List<Msg> list=md.getMailByReceiver(u.getUsername());
        out.print(list.size());
    %>
    <a href="write.jsp">写邮件</a>
    <table border="1"  width="1000">
    <tr>
    <td>邮件id</td>
    <td>发件人</td>
    <td>标题</td>
    <td>收件人</td>
    <td>状态</td>
    <td>时间</td>
    <td> </td>
    <td> </td>
    </tr>
    
    <%
    for(int i=0;i<list.size();i++){
     %>
     <tr>
     <td><%=list.get(i).getMsgid() %></td>
    <td><%=list.get(i).getUsernname() %></td>
    <td><a href="detail.jsp?id=<%=list.get(i).getMsgid()%>"><%=list.get(i).getTitle()%></a></td>
    <td><%=list.get(i).getSendto() %></td>
    <td><% if(list.get(i).getState()==1){ %>
    <img src="images/sms_unReaded.png"></img>
    <%}else{ %>
    <img src="images/sms_readed.png"></img>
    <%} %>
    
    
    </td><!-- 0已读,1未读 -->
    <td><%=list.get(i).getMsg_create_date() %></td>
     <td><a href="">回复</a></td>
      <td><a href="">删除</a></td>
     
     </tr>
     
     
     
     <%} %>
    
    
    </talbe>
    
    
    </body>
    </html>
    

      

    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
        <%@page import="java.sql.SQLException"%>
        
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="com.gd.dao.MsgDao"%>
    <%@page import="com.gd.entity.Users"%>
    <%@page import="java.util.List"%>
    <%@page import="com.gd.dao.BaseDao"%>
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="java.sql.DriverManager"%>
    <%@page import="java.sql.PreparedStatement"%>
    <%@page import="java.sql.ResultSet"%>
    <%@page import="java.sql.Connection"%>
    
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
    %>
    <!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>
    </head>
    <body>
        欢迎页面!!!欢迎你!!!<%
        Users u = (Users) session.getAttribute("user");
        out.print(u.getUsername());
        MsgDao md=new MsgDao();
        List<Msg> list=md.getMailByReceiver(u.getUsername());
        out.print(list.size());
    %>
    <a href="write.jsp">写邮件</a>
    <table border="1"  width="1000">
    <tr>
    <td>邮件id</td>
    <td>发件人</td>
    <td>标题</td>
    <td>收件人</td>
    <td>状态</td>
    <td>时间</td>
    <td> </td>
    <td> </td>
    </tr>
    
    <%
    for(int i=0;i<list.size();i++){
     %>
     <tr>
     <td><%=list.get(i).getMsgid() %></td>
    <td><%=list.get(i).getUsernname() %></td>
    <td><a href="detail.jsp?id=<%=list.get(i).getMsgid()%>"><%=list.get(i).getTitle()%></a></td>
    <td><%=list.get(i).getSendto() %></td>
    <td><% if(list.get(i).getState()==1){ %>
    <img src="images/sms_unReaded.png"></img>
    <%}else{ %>
    <img src="images/sms_readed.png"></img>
    <%} %>
    
    
    </td><!-- 0已读,1未读 -->
    <td><%=list.get(i).getMsg_create_date() %></td>
     <td><a href="">回复</a></td>
      <td><a href="">删除</a></td>
     
     </tr>
     
     
     
     <%} %>
    
    
    </talbe>
    
    
    </body>
    </html>
    

      

  • 相关阅读:
    文件复制
    linux 计划任务
    mysql查询权限的用户名密码
    mysql导入导出及复制
    windowslucene安装配置
    apache+php32位平台安装
    文件移动
    mysql查询权限的用户名密码
    取树状结构的某个值下的所有记录
    今天发生了个有趣的排序
  • 原文地址:https://www.cnblogs.com/TSHEN/p/12892721.html
Copyright © 2011-2022 走看看