write.jsp

<%@ 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>&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>