Skip to content

Commit

Permalink
hzuapps#3 提交实验代码
Browse files Browse the repository at this point in the history
  • Loading branch information
pigosy committed Oct 18, 2016
1 parent 5218a93 commit c6c5db5
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
56 changes: 56 additions & 0 deletions labs/1414080902231/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>javaweb 实验二</title>

<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
<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 type="text/javascript" src="index.js"></script>

</head>
<body>
<%=new java.util.Date().toLocaleString() %>
<p style=""><b>发布二手货物</b></p>
<form id="fm" action="rece.jsp" method="post">
<div class="form-group">
<p><label for="GoodsName">Goods Name</label><span style="color:red" id="p1"></span></p>
<input type="text" id="GoodsName" name="GoodsName" placeholder="Goods Name" style="width:320px"/>
</div>
<div class="form-group">
<p><label for="Detail">Detail</label><span style="color:red" id="p2"></span></p>
<textarea name="Detail" id="Detail" cols="50" rows="10" placeholder="Detail"></textarea>
</div>
<div class="form-group">
<p><label for="imgfile">Pictures input</label><span style="color:red" id="p3"></span></p>
<input name="imgfile" type="file" id="imgfile" accept="image/*">
</div>
</form>

<button type="submit" onclick="fun()">submit</button>
</body>


<script type="text/javascript" >
function fun(){
if(document.getElementById("GoodsName").value=='')
document.getElementById("p1").innerHTML="* not null";
if( document.getElementById("Detail").value=='')
document.getElementById("p2").innerHTML="* not null";
if( document.getElementById("imgfile").value=='')
document.getElementById("p3").innerHTML="* not null";
else
document.getElementById("fm").submit();
}
</script>




</html>
32 changes: 32 additions & 0 deletions labs/1414080902231/rece.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML >
<html>
<head>
<base href="<%=basePath%>">

<title>receive</title>

</head>

<body>
<%=new java.util.Date().toLocaleString() %>

<% String s1=request.getParameter("GoodsName");
String s2=request.getParameter("Detail");
String s3=request.getParameter("imgfile"); %>
<p>Goods Name:
<%=s1 %>
</p>
<p>Detail:
<%=s2 %>
</p>
<p>Pictures:
<%=s3 %>
</p>
</body>
</html>

0 comments on commit c6c5db5

Please sign in to comment.