jsp制作简单计算器
来源:互联网 发布:淘宝联盟 易语言源码 编辑:程序博客网 时间:2024/05/22 14:16
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
55
56
57
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
55
56
57
<%@page import="jdk.nashorn.internal.ir.RuntimeNode.Request"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<title>jsp计算器</title>
</head>
<body>
<h2>简单计算器</h2>
<form action="" method="post" name="form">
<input type="text" name="num1">
<Select name="operator">
<Option value="+">+
<Option value="-">-
<Option value="*">*
<Option value="/">/
</Select>
<input type="text" name="num2"> =
<br />
<br />
<input type="submit" value ="计算" name="submit">
</form>
<%
String num1=request.getParameter("num1");
String num2=request.getParameter("num2");
String operator=request.getParameter("operator");
float res=0f;
if(num1!=null && num2!=null){
float a=Float.parseFloat(num1);
float b=Float.parseFloat(num2);
if(operator.equals("+")){
res=a+b;
}
else if(operator.equals("-")){
res=a-b;
}
else if(operator.equals("*")){
res=a*b;
}
else
res=a/b;
}
%>
<p>结果为:<%= res %> </p>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<title>jsp计算器</title>
</head>
<body>
<h2>简单计算器</h2>
<form action="" method="post" name="form">
<input type="text" name="num1">
<Select name="operator">
<Option value="+">+
<Option value="-">-
<Option value="*">*
<Option value="/">/
</Select>
<input type="text" name="num2"> =
<br />
<br />
<input type="submit" value ="计算" name="submit">
</form>
<%
String num1=request.getParameter("num1");
String num2=request.getParameter("num2");
String operator=request.getParameter("operator");
float res=0f;
if(num1!=null && num2!=null){
float a=Float.parseFloat(num1);
float b=Float.parseFloat(num2);
if(operator.equals("+")){
res=a+b;
}
else if(operator.equals("-")){
res=a-b;
}
else if(operator.equals("*")){
res=a*b;
}
else
res=a/b;
}
%>
<p>结果为:<%= res %> </p>
</body>
</html>
0 0
- jsp制作简单计算器
- JSP+JavaBean制作计算器
- 简单的计算器制作
- jquery制作简单计算器
- JavaSwing制作简单计算器
- JavaScript: 制作简单计算器
- 简单的计算器制作
- JSP实现简单计算器
- JSP 简单的计算器
- jsp+javaBean简单计算器
- JSP+JavaBean简单计算器
- JSP简单计算器
- jsp简单计算器
- 【jsp简单应用】jsp计算器
- 制作一个简单的计算器
- flex 制作的简单计算器
- java---简单计算器的制作
- jsp简单应用:web计算器
- 在线自动生成.9png图的Android设计切图工具推荐
- Jsp之Tag文件和Tag标记
- nim IDE aporia的编译
- jdk配置
- Swift CoreData
- jsp制作简单计算器
- python中sklearn机器学习实现的博客
- Android自定义属性
- storm 开发系列一 第一个程序
- 三个annotation类型(RetentionPolicy,ElementType)
- java加载类详解
- linux
- java23中设计模式之工厂模式
- Linux多线程基础学习(三)线程生命周期