Skip to content

Commit

Permalink
Merge pull request #295 from OctRstar/master
Browse files Browse the repository at this point in the history
#4 提交实验代码
  • Loading branch information
zengsn authored Oct 28, 2016
2 parents b61be94 + ecba51b commit f0d5d33
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package edu.hzu.javaweb.labs.se1414080902215;

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

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

public class Se1414080902215Servlet 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("You're already to submit! ");
}

}
36 changes: 36 additions & 0 deletions jweb/web/1414080902215/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
</head>
<body align="center">
<%= new java.util.Date() %>
<form id="tijiao">
<div class="form-group">
<label for="user">User:</label>
<input type="text" class="form-control" id="user" name="username" placeholder="user">
</div>
<div class="form-group">
<label for="Password">Password:</label>
<input type="password" class="form-control" id="Password" name="password" placeholder="Password">
</div>

<button type="submit" class="btn btn-default">submit</button>
</form>
<script>
$( "#tijiao" ).submit(function() {
$.ajax({
url: "Se1414080902215Servlet",
datatype:"text/html",
type: "post",
success: function(data){
alert(data);
}});
});
</script>
</body>
</html>

0 comments on commit f0d5d33

Please sign in to comment.