-
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 #2 from hzuapps/master
wyz
- Loading branch information
Showing
268 changed files
with
48,581 additions
and
1 deletion.
There are no files selected for viewing
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
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+2.36 KB
jweb/build/classes/edu/hzu/javaweb/labs/se12345678/Se12345678Servlet.class
Binary file not shown.
Binary file added
BIN
+137 Bytes
jweb/build/classes/edu/hzu/javaweb/labs/se12345678/package-info.class
Binary file not shown.
Binary file not shown.
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,38 @@ | ||
/** | ||
* | ||
*/ | ||
package edu.hzu.javaweb.bean; | ||
|
||
/** | ||
* @author zengsn | ||
* @since 8.0 | ||
*/ | ||
public class UserData { | ||
private String username; | ||
private String email; | ||
private int age; | ||
|
||
public void setUsername(String value) { | ||
username = value; | ||
} | ||
|
||
public void setEmail(String value) { | ||
email = value; | ||
} | ||
|
||
public void setAge(int value) { | ||
age = value; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public int getAge() { | ||
return age; | ||
} | ||
} |
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,7 @@ | ||
/** | ||
* 这里为实验的Java代码。各人的代码放在各自学号的包下。 | ||
* | ||
* @author zengsn | ||
* @since 8.0 | ||
*/ | ||
package edu.hzu.javaweb.labs; |
57 changes: 57 additions & 0 deletions
57
jweb/src/edu/hzu/javaweb/labs/se12345678/Se12345678Servlet.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,57 @@ | ||
package edu.hzu.javaweb.labs.se12345678; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.ServletConfig; | ||
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 javax.servlet.http.HttpSession; | ||
|
||
@WebServlet("/1st") | ||
public class Se12345678Servlet extends HttpServlet { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public Se12345678Servlet() { | ||
super(); | ||
} | ||
|
||
public void init(ServletConfig config) throws ServletException { | ||
|
||
} | ||
|
||
public void destroy() { | ||
} | ||
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
// 已登录 | ||
String login = "zhang3"; | ||
// Session | ||
HttpSession session = request.getSession(true); | ||
session.setAttribute("username", login); // 登录之后 | ||
String username = (String) session.getAttribute("username"); | ||
if (username == null) { | ||
|
||
} | ||
|
||
session.setMaxInactiveInterval(15); | ||
|
||
// 返回HTML | ||
StringBuilder html = new StringBuilder(); | ||
html.append("<!DOCTYPE html><html><head>"); | ||
html.append("<title>First App</title>"); | ||
html.append("</head><body>"); | ||
html.append("<a id=\"link\" href=\"www.hzu.edu.cn\">惠州学院</a>"); | ||
html.append("</body></html>"); | ||
response.setCharacterEncoding("utf-8"); | ||
response.getWriter().append(html); | ||
} | ||
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
doGet(request, response); | ||
} | ||
|
||
} |
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,8 @@ | ||
|
||
/** | ||
* 把 12345678 即为学号。 | ||
* | ||
* @author zengsn | ||
* @since 8.0 | ||
*/ | ||
package edu.hzu.javaweb.labs.se12345678; |
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,42 @@ | ||
package edu.hzu.javaweb.servlet; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.ServletConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
/** | ||
* 这是学号为12345678同学的Java代码。 | ||
* | ||
* @author zengsn | ||
* @since 8.0 | ||
*/ | ||
@WebServlet("/12345678") | ||
public class FirstServlet extends HttpServlet { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public FirstServlet() { | ||
super(); | ||
} | ||
|
||
public void init(ServletConfig config) throws ServletException { | ||
|
||
} | ||
|
||
public void destroy() { | ||
} | ||
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
System.out.println("doGet() -> 这是 12345678 的后台。"); | ||
} | ||
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
doGet(request, response); | ||
} | ||
|
||
} |
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 @@ | ||
各人创建自己的学号目录。 |
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,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Insert title here</title> | ||
</head> | ||
<body> | ||
<FORM METHOD=POST ACTION="SaveName.jsp"> | ||
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR> | ||
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR> | ||
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4> | ||
<P> | ||
<INPUT TYPE=SUBMIT> | ||
</FORM> | ||
</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,15 @@ | ||
<jsp:useBean id="user" class="edu.hzu.javaweb.bean.UserData" | ||
scope="session" /> | ||
<HTML> | ||
<BODY> | ||
<FORM METHOD=POST ACTION="SaveName.jsp"> | ||
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20 | ||
VALUE="<%=user.getUsername()%>"><BR> What's your | ||
e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20 | ||
VALUE="<%=user.getEmail()%>"><BR> What's your age? <INPUT | ||
TYPE=TEXT NAME=age SIZE=4 VALUE=<%=user.getAge()%>> | ||
<P> | ||
<INPUT TYPE=SUBMIT> | ||
</FORM> | ||
</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,3 @@ | ||
Manifest-Version: 1.0 | ||
Class-Path: | ||
|
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,10 @@ | ||
<jsp:useBean id="user" class="edu.hzu.javaweb.bean.UserData" | ||
scope="session" /> | ||
<HTML> | ||
<BODY> | ||
You entered<BR> | ||
Name: <%= user.getUsername() %><BR> | ||
Email: <%= user.getEmail() %><BR> | ||
Age: <%= user.getAge() %><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,8 @@ | ||
<jsp:useBean id="user" class="edu.hzu.javaweb.bean.UserData" | ||
scope="session" /> | ||
<jsp:setProperty name="user" property="*" /> | ||
<HTML> | ||
<BODY> | ||
<A HREF="NextPage.jsp">Continue</A> | ||
</BODY> | ||
</HTML> |
Binary file not shown.
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> | ||
<display-name>jweb</display-name> | ||
<welcome-file-list> | ||
<welcome-file>index.html</welcome-file> | ||
<welcome-file>index.htm</welcome-file> | ||
<welcome-file>index.jsp</welcome-file> | ||
<welcome-file>default.html</welcome-file> | ||
<welcome-file>default.htm</welcome-file> | ||
<welcome-file>default.jsp</welcome-file> | ||
</welcome-file-list> | ||
</web-app> |
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,14 @@ | ||
<%@ page isErrorPage="true"%> | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> | ||
<html> | ||
<head> | ||
<title><fmt:message key="ServerError" /></title> | ||
</head> | ||
<body bgcolor="white"> | ||
<h3> | ||
<fmt:message key="ServerError" /> | ||
</h3> | ||
<p>: ${pageContext.errorData.throwable.cause} | ||
</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 @@ | ||
<p>©<%=new java.util.Date()%> Copy Rights.</p> |
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 @@ | ||
OK |
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,16 @@ | ||
<%@ page language="java" contentType="text/html; charset=UTF-8" | ||
pageEncoding="UTF-8"%> | ||
<%@ page import="java.util.*" %> | ||
<!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><%=new Date()%></title> | ||
</head> | ||
<body> | ||
<%=new Date()%> | ||
|
||
<hr /> | ||
<center><%@ include file="footer.jsp" %></center> | ||
</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,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; | ||
} |
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,38 @@ | ||
<!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> | ||
<div id="main_special"> | ||
<fieldset><legend>登录</legend> | ||
<form action="" method="post"> | ||
<label for="label1">用 户 名:</label> | ||
<input type="text" name="name" id="username label1"/><font style="font-size:12px;color:#898983"> *用户名不得超过16位字符</font><br> | ||
<label for="label2">密 码:</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> | ||
<script type="text/javascript"> | ||
$( ".submit" ).click(function(event) { | ||
alert("登录成功"); | ||
$.ajax({ | ||
url: "success.json" | ||
}).done(function(data){ | ||
if (console&&console.log){ | ||
var account = $('#username').value; | ||
var password = $('#password').value; | ||
console.dir(data); | ||
alert(data.msg); | ||
} | ||
}) | ||
}); | ||
</script> | ||
</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,3 @@ | ||
{ | ||
"msg": "保存成功!" | ||
} |
Oops, something went wrong.