<table><tbody><tr><td>1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;10&lt;br&gt;11&lt;br&gt;12&lt;br&gt;13&lt;br&gt;14&lt;br&gt;15&lt;br&gt;16&lt;br&gt;17&lt;br&gt;18&lt;br&gt;19&lt;br&gt;20&lt;br&gt;21&lt;br&gt;22&lt;br&gt;23&lt;br&gt;24&lt;br&gt;25&lt;br&gt;26&lt;br&gt;27&lt;br&gt;28&lt;br&gt;29&lt;br&gt;30&lt;br&gt;31&lt;br&gt;32&lt;br&gt;33&lt;br&gt;34&lt;br&gt;35&lt;br&gt;36&lt;br&gt;37&lt;br&gt;38&lt;br&gt;39&lt;br&gt;40&lt;br&gt;41&lt;br&gt;42&lt;br&gt;43&lt;br&gt;44&lt;br&gt;45&lt;br&gt;46&lt;br&gt;47&lt;br&gt;48&lt;br&gt;49&lt;br&gt;50&lt;br&gt;51&lt;br&gt;52&lt;br&gt;53&lt;br&gt;54&lt;br&gt;55&lt;br&gt;56&lt;br&gt;57&lt;br&gt;58&lt;br&gt;59&lt;br&gt;60&lt;br&gt;61&lt;br&gt;62&lt;br&gt;63&lt;br&gt;64&lt;br&gt;65&lt;br&gt;66&lt;br&gt;67&lt;br&gt;68&lt;br&gt;69&lt;br&gt;70&lt;br&gt;71&lt;br&gt;72&lt;br&gt;73&lt;br&gt;74&lt;br&gt;75&lt;br&gt;76&lt;br&gt;77&lt;br&gt;78&lt;br&gt;79&lt;br&gt;80&lt;br&gt;81&lt;br&gt;82&lt;br&gt;83&lt;br&gt;84&lt;br&gt;85&lt;br&gt;86&lt;br&gt;87&lt;br&gt;88&lt;br&gt;89&lt;br&gt;90&lt;br&gt;91&lt;br&gt;92&lt;br&gt;93&lt;br&gt;94&lt;br&gt;95&lt;br&gt;96&lt;br&gt;97&lt;br&gt;98&lt;br&gt;99&lt;br&gt;100&lt;br&gt;101&lt;br&gt;102&lt;br&gt;103&lt;br&gt;104&lt;br&gt;105&lt;br&gt;106&lt;br&gt;107&lt;br&gt;108&lt;br&gt;109&lt;br&gt;110&lt;br&gt;111&lt;br&gt;112&lt;br&gt;113&lt;br&gt;114&lt;br&gt;115&lt;br&gt;116&lt;br&gt;117&lt;br&gt;118&lt;br&gt;119&lt;br&gt;120&lt;br&gt;121&lt;br&gt;122&lt;br&gt;123&lt;br&gt;124&lt;br&gt;125&lt;br&gt;126&lt;br&gt;127&lt;br&gt;128&lt;br&gt;129&lt;br&gt;130&lt;br&gt;131&lt;br&gt;132&lt;br&gt;133&lt;br&gt;134&lt;br&gt;135&lt;br&gt;136&lt;br&gt;137&lt;br&gt;138&lt;br&gt;139&lt;br&gt;140&lt;br&gt;141&lt;br&gt;142&lt;br&gt;143&lt;br&gt;144&lt;br&gt;145&lt;br&gt;146&lt;br&gt;147&lt;br&gt;148&lt;br&gt;149&lt;br&gt;150&lt;br&gt;151&lt;br&gt;152&lt;br&gt;153&lt;br&gt;154&lt;br&gt;155&lt;br&gt;156&lt;br&gt;157&lt;br&gt;158&lt;br&gt;159&lt;br&gt;160&lt;br&gt;161&lt;br&gt;162&lt;br&gt;163&lt;br&gt;164&lt;br&gt;165&lt;br&gt;166&lt;br&gt;167&lt;br&gt;168&lt;br&gt;169&lt;br&gt;170&lt;br&gt;171&lt;br&gt;172&lt;br&gt;173&lt;br&gt;174&lt;br&gt;175&lt;br&gt;176&lt;br&gt;177&lt;br&gt;178&lt;br&gt;179&lt;br&gt;180&lt;br&gt;181&lt;br&gt;182&lt;br&gt;183&lt;br&gt;184&lt;br&gt;185&lt;br&gt;186&lt;br&gt;187&lt;br&gt;188&lt;br&gt;189&lt;br&gt;190&lt;br&gt;191&lt;br&gt;192&lt;br&gt;193&lt;br&gt;194&lt;br&gt;195&lt;br&gt;196&lt;br&gt;197&lt;br&gt;198&lt;br&gt;199&lt;br&gt;200&lt;br&gt;201&lt;br&gt;202&lt;br&gt;203&lt;br&gt;204&lt;br&gt;205&lt;br&gt;206&lt;br&gt;207&lt;br&gt;208&lt;br&gt;209&lt;br&gt;210&lt;br&gt;211&lt;br&gt;212&lt;br&gt;213&lt;br&gt;214&lt;br&gt;215&lt;br&gt;216&lt;br&gt;217&lt;br&gt;218&lt;br&gt;219&lt;br&gt;220&lt;br&gt;221&lt;br&gt;222&lt;br&gt;223&lt;br&gt;224&lt;br&gt;225&lt;br&gt;226&lt;br&gt;227&lt;br&gt;228&lt;br&gt;229&lt;br&gt;230&lt;br&gt;231&lt;br&gt;232&lt;br&gt;233&lt;br&gt;234&lt;br&gt;235&lt;br&gt;236&lt;br&gt;237&lt;br&gt;238&lt;br&gt;239&lt;br&gt;240&lt;br&gt;241&lt;br&gt;242&lt;br&gt;243&lt;br&gt;244&lt;br&gt;245&lt;br&gt;246&lt;br&gt;247&lt;br&gt;248&lt;br&gt;249&lt;br&gt;250&lt;br&gt;251&lt;br&gt;252&lt;br&gt;253&lt;br&gt;254&lt;br&gt;255&lt;br&gt;256&lt;br&gt;257&lt;br&gt;258&lt;br&gt;259&lt;br&gt;260&lt;br&gt;261&lt;br&gt;262&lt;br&gt;263&lt;br&gt;264&lt;br&gt;265&lt;br&gt;266&lt;br&gt;267&lt;br&gt;268&lt;br&gt;269&lt;br&gt;270&lt;br&gt;271&lt;br&gt;272&lt;br&gt;273&lt;br&gt;274&lt;br&gt;275&lt;br&gt;276&lt;br&gt;277&lt;br&gt;278&lt;br&gt;279&lt;br&gt;280&lt;br&gt;281&lt;br&gt;282&lt;br&gt;283&lt;br&gt;284&lt;br&gt;285&lt;br&gt;286&lt;br&gt;287&lt;br&gt;288&lt;br&gt;289&lt;br&gt;290&lt;br&gt;291&lt;br&gt;292&lt;br&gt;293&lt;br&gt;294&lt;br&gt;295&lt;br&gt;296&lt;br&gt;297&lt;br&gt;298&lt;br&gt;299</td><td>&lt;%@ page language="java"import="java.util.*"pageEncoding="utf-8"%&gt;
&lt;%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%&gt;

&lt;!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My JSP'register.jsp'starting page&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;script type="text/javascript"&gt;
function validate(){
if(registerForm.uname.value==""){
alert("账号不能为空!");
return;
}
if(registerForm.upwd.value==""){
alert("密码不能为空!");
return;
}
registerForm.submit();
}
&lt;/script&gt;

&lt;form  name="registerForm"action="DoregServlet"method="post"&gt;

用户名:&lt;input type="text"name="uname"&gt;&lt;br&gt;
密   码: &lt;input type="password"name="upwd"&gt; &lt;br&gt;
&lt;input type="submit"value="注册"&gt;
&lt;a href="denglu.jsp"&gt;登录&lt;/a&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;



packagecom.servlet;

importjava.io.IOException;
importjava.io.PrintWriter;

importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;

importcom.dao.UsersDao;

publicclassservlet3extendsHttpServlet {

publicservlet3() {
super();
}


publicvoiddestroy() {
super.destroy();// Just puts "destroy" string in log
// Put your code here
}


publicvoiddoGet(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {
doPost (request, response);

}


publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

String uname = request.getParameter("uname");
String upwd = request.getParameter("upwd");
UsersDao usersDao =newUsersDao();
inti=usersDao.reg(uname, upwd);
if(i&gt;0){

response.setHeader("refresh","2;url=login.jsp");
}else{

response.setHeader("refresh","2;url=reg.jsp");
}
}

/**
* Initialization of the servlet. &lt;br&gt;
*
* @throws ServletException if an error occurs
*/
publicvoidinit()throwsServletException {
// Put your code here
}

}





packagecom.sf.servlet;

importjava.io.IOException;
importjava.io.PrintWriter;

importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;

importcom.sf.dao.MsgDao;
importcom.sf.dao.UsersDao;

publicclassDoregservletextendsHttpServlet {

/**
* Constructor of the object.
*/
publicDoregservlet() {
super();
}

/**
* Destruction of the servlet. &lt;br&gt;
*/
publicvoiddestroy() {
super.destroy();// Just puts "destroy" string in log
// Put your code here
}

publicvoiddoGet(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
request.setCharacterEncoding("utf-8");
String uname = request.getParameter("uname");
String upwd = request.getParameter("upwd");

UsersDao ud =newUsersDao();
MsgDao md =newMsgDao();
if(ud.register(uname, upwd) &gt;0) {
request.getSession().setAttribute("uname", uname);
request.getRequestDispatcher("denglu.jsp").forward(request,
response);
}else{
out.print("注册失败，请重新注册.......");
response.setHeader("refresh","3;url=reg.jsp");
}
}
publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

doGet(request,response);
}

/**
* Initialization of the servlet. &lt;br&gt;
*
* @throws ServletException if an error occurs
*/
publicvoidinit()throwsServletException {
// Put your code here
}

}





packagecom.servlet;

importjava.io.IOException;
importjava.io.PrintWriter;

importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;

importcom.dao.MsgDao;

publicclassservlet5extendsHttpServlet {

publicservlet5() {
super();
}

publicvoiddestroy() {
super.destroy();// Just puts "destroy" string in log
// Put your code here
}


publicvoiddoGet(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

doPost(request,  response);
}


publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

request.setCharacterEncoding("utf-8");

intid=Integer.parseInt(request.getParameter("id"));
MsgDao md=newMsgDao();
md.delMail(id);
response.getWriter().print("刪除成功.....");
response.setHeader("refresh","2;url=main.jsp");
response.sendRedirect("main2.jsp");
}


publicvoidinit()throwsServletException {

}

}







packagecom.sf.servlet;

importjava.io.IOException;
importjava.io.PrintWriter;

importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;

importcom.sf.dao.MsgDao;
importcom.sf.entity.Msg;

publicclassDowriteservletextendsHttpServlet {

/**
* Constructor of the object.
*/
publicDowriteservlet() {
super();
}

/**
* Destruction of the servlet. &lt;br&gt;
*/
publicvoiddestroy() {
super.destroy();// Just puts "destroy" string in log
// Put your code here
}

publicvoiddoGet(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
request.setCharacterEncoding("utf-8");
String uname = (String) request.getSession().getAttribute("uname");
String sendto = request.getParameter("receiver");
String title = request.getParameter("title");
String content = request.getParameter("content");

Msg m =newMsg();
m.setMsgcontent(content);
m.setUsername(uname);
m.setSendto(sendto);
m.setTitle(title);

MsgDao md =newMsgDao();
md.addMsg(m);

out.print("发送成功.....");
response.setHeader("refresh","3;url=main.jsp");
}

publicvoiddoPost(HttpServletRequest request, HttpServletResponse response)
throwsServletException, IOException {

doGet(request,response);     }

/**
* Initialization of the servlet. &lt;br&gt;
*
* @throws ServletException if an error occurs
*/
publicvoidinit()throwsServletException {
}

}</td></tr></tbody></table>
