• 第八次JSP作业


    <%@ 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 'index.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>
       <form action="dologin.jsp" method="post">
    用户名:<input type="text" name="uname" value="小白" /><Br>
    密码 :<input type="password" name="upwd" value="88888"/><br>
    
    <input type="submit" value="登录">
    
    </form>
      </body>
    </html>
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="com.gd.dao.MsgDao"%>
    <%@page import="com.gd.entity.Users"%>
    <%@ 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 'index.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>
        欢迎页面!!!欢迎你!!!<%
        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="">写邮件</a>
    <table border="1"  width="1000">
    <tr>
    <td>邮件id</td>
    <td>发件人</td>
    <td>标题</td>
    <td>收件人</td>
    <td>状态</td>
    <td>时间</td>
    <td>&nbsp;</td>
    <td>&nbsp;</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 import="com.gd.entity.Users"%>
    <%@page import="com.gd.dao.UsersDao"%>
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%
        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");
    %>
    <%@page import="com.gd.entity.Msg"%>
    <%@page import="com.gd.dao.MsgDao"%>
    <%@ 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 'index.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>
        <%
            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>

  • 相关阅读:
    webpack2使用ch4-向根目录index.html文件传参并使用参数 使用线上资源 压缩html
    webpack2使用ch3-自动化生成.html和内部引入的js自动更改
    webpack2使用ch2-entry和output简要说明
    webpack2使用ch1-目录说明
    less使用ch1--简单使用
    less使用ch1--认识语法
    vue2购物车ch4-(筛选v-for 点击的那个设置样式 设为默认地址其他 联动 非循环的列表选中和非选中 删除当前选中的列表)
    gulp使用2-gulp-less及watch和错误提示
    gulp使用1-入门指南
    vue2购物车ch3-(过滤器使用 单件商品金额计算 全选全不选 总金额计算 删除商品功能)
  • 原文地址:https://www.cnblogs.com/zq542960954/p/12877472.html
Copyright © 2020-2023  润新知