Skip to content

Commit

Permalink
#4 提交实验代码
Browse files Browse the repository at this point in the history
  • Loading branch information
mpq1228 committed Oct 27, 2016
1 parent 18e9518 commit b5944e6
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package edu.hzu.javaweb.labs.se1406070302213;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Se1406070302213Servlet extends HttpServlet {

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

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println(" Hello!Mr Zeng!");
out.println(" <br>");
out.println(" My student number is 1406070302213.Thanks!");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println(" Hello!Mr Zeng!");
out.println(" <br>");
out.println(" My student number is 1406070302213.Thanks!");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

}
34 changes: 34 additions & 0 deletions jweb/web/1406070302213/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE html>
<html lang="zh-CN">
<head>
<link rel="stylesheet" type="text/css" href="mpq.css"/>
<title>登录</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<center>
<h1><%=new java.util.Date()%></h1>
</center>
<div id="main_special">
<fieldset><legend>登录</legend>
<form action="1406070302213" method="get">
<label for="label1">用&nbsp;&nbsp; 名:</label>
<input type="text" name="name" id="username label1"/><font style="font-size:12px;color:#898983"> *用户名不得超过16位字符</font><br>
<label for="label2">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</label>
<input type="password" name="pw" id="password label2"/><font style="font-size:12px;color:#898983"> *密码不能超过16位字符</font><br>
<input type="submit" name="submit" class="submit" value="登录"/>
<input type="reset" name="reset" class="submit" value="重置"/>
</form>
</fieldset>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions jweb/web/1406070302213/mpq.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@CHARSET "UTF-8";

#main_special{
margin:80px 0 0 50px;
}
#main_special form input{

height:22px;
margin-bottom:20px;
}
#main_special fieldset{
width:450px;
}
#main_special label{
font-size:15px;

}
#main_special #label4{
width:50px;
}
#main_special form{
margin:20px;
padding:0px;
}
#main_special .submit{
margin:10px 0 0 0px;
}
#main_special img{
margin:0 0 0 80px;
}

0 comments on commit b5944e6

Please sign in to comment.