-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path552homework-fengliu.jsp
More file actions
54 lines (44 loc) · 1.42 KB
/
552homework-fengliu.jsp
File metadata and controls
54 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!--fengliu -->
<%@ page import="java.io.*" %>
<%
String length = request.getParameter("length");
String area = request.getParameter("area");
if(length != null && area != null){
String file = application.getRealPath("/") + "fengliu-databaseForTomcat.txt";
FileWriter filewriter = new FileWriter(file, true);
filewriter.write(length+" ");
filewriter.write(area+" ");
filewriter.close();
}
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=2.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>homework for CPE552-fengliu</title>
</head>
<label for="materials">Choose a material:</label>
<select id="materials">
<option value="copper">copper</option>
<option value="tungsten">tungsten</option>
<option value="aluminum">aluminum</option>
</select>
<body>
<form method="GET" action="552homework-fengliu.jsp">
length(m)
<input type="text" name="length">
area(m^2)
<input type="text" name="area">
<input type="submit" name="sub_btn" value="submit" onclick="tan()"style="width:100px; height:50px; font-family:TimesNewRoman; color:black;">
</form>
</body>
<script>
function tan()
{
document.write("运算结果是:"+(length/area));
document.write("<h1>it should be works<h1>");
}
</script>
</html>