Skip to content

Commit

Permalink
Merge pull request #263 from choisound/master
Browse files Browse the repository at this point in the history
#4 提交实验代码
  • Loading branch information
zengsn authored Oct 24, 2016
2 parents 885f650 + 4d1c827 commit 1aa3e5d
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 0 deletions.
66 changes: 66 additions & 0 deletions jweb/src/edu/hzu/javaweb/labs/se1414080902226/Qiandao.java
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 jweb/src/edu/hzu/javaweb/labs/se1414080902226/ReturnInfo.java
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
+ "]";
}

}
Binary file added jweb/web/1414080902226/a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions jweb/web/1414080902226/index.html
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>
26 changes: 26 additions & 0 deletions jweb/web/1414080902226/index.jsp
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>
18 changes: 18 additions & 0 deletions jweb/web/1414080902226/js.js
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");
}
69 changes: 69 additions & 0 deletions jweb/web/1414080902226/qiandao.jsp
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="&nbsp;&nbsp;&nbsp;">
<input type="reset" value="&nbsp;&nbsp;&nbsp;">
</div>
</form>
</div>

</body>
</html>
Binary file added jweb/web/1414080902226/timg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1aa3e5d

Please sign in to comment.