-
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 #246 from ChowWd/master
#4 提交实验代码
- Loading branch information
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
jweb/src/edu/hzu/javaweb/labs/se1414080902221/Se1414080902221Servlet.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,28 @@ | ||
package edu.hzu.javaweb.labs.se1414080902221; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
|
||
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.xml.ws.WebServiceRefs; | ||
@WebServlet("/1414080902221") | ||
public class Se1414080902221Servlet extends HttpServlet { | ||
|
||
public void doGet(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
doPost(request,response); | ||
} | ||
|
||
public void doPost(HttpServletRequest request, HttpServletResponse response) | ||
throws ServletException, IOException { | ||
|
||
response.setContentType("text/html"); | ||
PrintWriter out = response.getWriter(); | ||
out.println("Success"); | ||
} | ||
|
||
} |
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,50 @@ | ||
<%@ 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>提交</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 java.util.Date() %> | ||
<form id="regist"> | ||
<div class="form-group"> | ||
<label for="UserName">UserName</label> | ||
<input type="text" class="form-control" id="UserName" placeholder="UserName"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="Password1">Password</label> | ||
<input type="password" class="form-control" id="Password" placeholder="Password"> | ||
</div> | ||
<button type="button" class="btn btn-default">Submit</button> | ||
</form> | ||
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> | ||
<script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> | ||
<script> | ||
$( "#regist" ).click(function() { | ||
$.ajax({ | ||
url: "Se1414080902221Servlet", | ||
datatype:"html", | ||
type: "post", | ||
success: function(data){ | ||
alert(data); | ||
}}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |