-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from choisound/master
#4 提交实验代码
- Loading branch information
Showing
8 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
jweb/src/edu/hzu/javaweb/labs/se1414080902226/Qiandao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package edu.hzu.javaweb.labs.se1414080902226; | ||
|
||
import java.io.IOException; | ||
|
||
|
||
import java.io.PrintWriter; | ||
|
||
import javax.jws.WebService; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
import com.alibaba.fastjson.JSONArray; | ||
|
||
|
||
|
||
@WebServlet(name="helloWorldServlet",urlPatterns="/1414080902226") | ||
public class Qiandao extends HttpServlet { | ||
|
||
/** | ||
* Constructor of the object. | ||
*/ | ||
public Qiandao() { | ||
super(); | ||
} | ||
|
||
/** | ||
* 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 { | ||
ReturnInfo ri=new ReturnInfo(); | ||
ri.setIsSuccess("µÇ½³É¹¦"); | ||
ri.setZhanghao(request.getParameter("count")); | ||
request.setCharacterEncoding("UTF-8"); | ||
request.setAttribute("returninfo", JSONArray.toJSON(ri)); | ||
request.getRequestDispatcher("/index.jsp").forward(request, response); | ||
} | ||
|
||
/** | ||
* 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 { | ||
|
||
doGet(request, response); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
jweb/src/edu/hzu/javaweb/labs/se1414080902226/ReturnInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package edu.hzu.javaweb.labs.se1414080902226; | ||
|
||
public class ReturnInfo { | ||
private String isSuccess; | ||
private String zhanghao ; | ||
public String getIsSuccess() { | ||
return isSuccess; | ||
} | ||
public void setIsSuccess(String isSuccess) { | ||
this.isSuccess = isSuccess; | ||
} | ||
public String getZhanghao() { | ||
return zhanghao; | ||
} | ||
public void setZhanghao(String zhanghao) { | ||
this.zhanghao = zhanghao; | ||
} | ||
@Override | ||
public String toString() { | ||
return "ReturnInfo [isSuccess=" + isSuccess + ", zhanghao=" + zhanghao | ||
+ "]"; | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
<!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 > | ||
签到成功。 | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<%@ 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> | ||
<%=request.getAttribute("returninfo") %> | ||
<body> | ||
This is my JSP page. <br> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
function submitform(form){ | ||
if(form.count.value=='') { | ||
alert("请输入用户帐号!"); | ||
form.count.focus(); | ||
return false; | ||
} | ||
if(form.password.value==''){ | ||
alert("请输入登录密码!"); | ||
form.password.focus(); | ||
return false; | ||
} | ||
form.action="index.html"; | ||
form.submit(); | ||
} | ||
function test(){ | ||
alert("test"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<%@ 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 > | ||
现在时间是:<%=new Date() %> | ||
<img src="timg.jpg"width=100% height=100% > | ||
<div style="position:absolute; left:0; top:0; width:100%; height:100%"> | ||
<script type='text/javascript'> | ||
function submitform(form){ | ||
if(form.count.value=='') { | ||
alert("请输入学号!"); | ||
form.count.focus(); | ||
return false; | ||
} | ||
if(form.password.value==''){ | ||
alert("请输入班级!"); | ||
form.password.focus(); | ||
return false; | ||
} | ||
form.action="/qiandaoxitong/servlet/qiandao.do"; | ||
form.submit(); | ||
} | ||
function test(){ | ||
alert("test"); | ||
} | ||
</script> | ||
<br> | ||
<br> | ||
<form id="login_form" method="post" > | ||
<div style="width:100%;text-align:center"> | ||
<p ><font color="#F00" ><font size="4">上课签到系统</font></font></p> </div> | ||
<div style="width:100%;text-align:center"> | ||
<label class="t"><font color="#F00" >学 号:</font></label> | ||
<input id="count" value="" name="count" type="text"> | ||
</div> | ||
|
||
<div style="width:100%;text-align:center"> | ||
<label class="t"><font color="#F00" >班 级:</font></label> | ||
<input id="password" value="" name="password" type="password" > | ||
</div> | ||
<div style="width:100%;text-align:center"> | ||
<label class="t"></label> | ||
<input type="submit" onclick="submitform(this.form)" value=" 签 到 "> | ||
<input type="reset" value=" 重 置 "> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.