Skip to content

Commit

Permalink
hzuapps#4 提交实验代码
Browse files Browse the repository at this point in the history
  • Loading branch information
yoxiang committed Dec 1, 2016
1 parent 4ee7ffb commit 3ff3491
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package edu.hzu.javaweb.labs.se1414080902121;

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;

@WebServlet("/1414080902121")
public class Se1414080902121Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

doPost(request,response);
}


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Sign in Successfully!");
}

}
64 changes: 64 additions & 0 deletions jweb/web/1414080902121/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<%@ page language="java" contentType="text/html; charset=utf-8"
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" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>菜鸡课表系统</title>
<link href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="desu">

<h3 class="text-center" style="margin-top: 100px">欢迎使用!</h3>
<div class="row" style="width:300px; margin:auto;height:150px;">
<form role="form" id="login">
<div class="form-group">
<div class="has-feedback" >
<label for="exampleInputEmail1">邮箱</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter your Account">

</div>
</div>

<div class="form-group">
<div class="has-feedback" >
<label for="exampleInputPassword1">密码</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Enter your Password">
</div>
</div>
<center>
<button type="submit" class="btn btn-success">登陆</button>

</center>
</form>
</div>
</div>

<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>
$( "#login" ).submit(function() {
$.ajax({
dataType: "html",
url: "1414080902121",
type: "post",
success: function(data){
alert(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("error");
}
});
});
</script>


</body>
</html>

0 comments on commit 3ff3491

Please sign in to comment.