• JSP第九次作业


    index

    <%@ 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>
      <script type="text/javascript">
       function mycheck() {
     
    //判断验证码是否为空
     if (form1.validationCode.value==""){
    alert("验证码不能为空,请输入验证码!");
     form1.validationCode.focus();
     return;
     }
     //判断验证码是否正确
     if (form1.validationCode.value != form1.validationCode1.value) {
     alert("请输入正确的验证码!!");
     form1.validationCode.focus();
     return;
     }
     form1.submit1();
     }
     </script>
      <body>
       <form action="dologin.jsp" method="post">
    用户名:<input type="text" name="uname" value="zq" /><Br>
    密码 :<input type="password" name="upwd" value="123456"/><br>
     <br>
     验证码:<input type="text" name="validationCode" 
     onKeyDown="if(event.keyCode==13){form1.submit.focus();}" size="6">
     <%
     int intmethod1 = (int) ((((Math.random()) * 11)) - 1);
     int intmethod2 = (int) ((((Math.random()) * 11)) - 1);
     int intmethod3 = (int) ((((Math.random()) * 11)) - 1);
     int intmethod4 = (int) ((((Math.random()) * 11)) - 1);
     //将得到的随机数进行连接
     String intsum = intmethod1 +""+ intmethod2+intmethod3+intmethod4;
     %>
     <!-- 设置隐藏域,验证比较时使用-->
     <input type="hidden" name="validationCode1" 
    value="<%=intsum%>">
     <!-- 将图片名称与得到的随机数相同的图片显示在页面上 --> 
     <img src="images/<%=intmethod1%>.png"> 
     <img src="images/<%=intmethod2%>.png"> 
     <img src="images/<%=intmethod3%>.png">
     <img src="images/<%=intmethod4%>.png"> 
     <br>
    <input type="submit" value="登录">
    <a href="register.jsp">注册</a>
    </form>
      </body>
    </html>

    main

    <%@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="write.jsp">写邮件</a>
        <a href="logout.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).getUsername()%></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() == 0) {
                    %> <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="write.jsp?mailto=<%=list.get(i).getUsername() %>">回复</a>
                </td>
                <td> <a href="delete.jsp?delid=<%=list.get(i).getMsgid()%>">   删除</a>
                </td>
    
            </tr>
    
    
    
            <%
                }
            %>
    
    
        </table>
    
    
    </body>
    </html>

    register

    <%@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>
        <form action="dowrite.jsp" method="post">
            <p>
                收件人:<input type="text" name="sjr" value=<%=request.getParameter("mailto") %> />
            </p>
            <p>
                标题:<input type="text" name="title" />
            </p>
            <p>
                内容:<input type="text" name="content" />
            </p>
            <input type="submit" value="发送">
        </form>
        
        <a href="main.jsp">返回</a>
    </body>
    </html>

  • 相关阅读:
    Mac新手必看教程——轻松玩转Mac OS
    《图解 HTTP》 学习笔记
    在浏览器输入 URL 回车之后发生了什么(超详细版)
    VMware Ubuntu 19最新安装详细过程
    【学习笔记】第八章 python3核心技术与实践--条件与循环
    【学习笔记】第七章 python3核心技术与实践--输入与输出
    【学习笔记】第六章 python核心技术与实践--深入浅出字符串
    Prometheus搭建
    java---yml文件配置
    Nginx一个server配置多个location(使用alias)
  • 原文地址:https://www.cnblogs.com/zq542960954/p/12922097.html
Copyright © 2020-2023  润新知