Skip to content

Commit

Permalink
Merge pull request #246 from ChowWd/master
Browse files Browse the repository at this point in the history
#4 提交实验代码
  • Loading branch information
zengsn authored Oct 24, 2016
2 parents 39b68e9 + c67252a commit a0b6c84
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
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");
}

}
50 changes: 50 additions & 0 deletions jweb/web/1414080902221/index.jsp
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>

0 comments on commit a0b6c84

Please sign in to comment.