Simple Calculator
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<! DOCTYPE html>
03
<Html>
04
<Head>
05
<Title> simple calculator </title>
06
</Head>
07
<Body>
08
<H1> simple calculator 09
<Hr/>
10
<Form action = "result. jsp">
11
<Input type = "text" name = "number1"/>
12
<Select name = "ope">
13
<Option value = "add"> + </option>
14
<Option value = "minus">-</option>
15
<Option value = "multiply"> * </option>
16
<Option value = "div">/</option>
17
</Select>
18
<Input type = "text" name = "number2"/>
19
<Input type = "submit" value = "computing"/>
20
<Input type = "reset" value = "reset">
21
</Form>
22
</Body>
23
</Html>
01
<% @ Page language = "java" contentType = "text/html; charset = gb2312" %>
02
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
03
<! DOCTYPE html>
04
<Html>
05
<Head>
06
<Title> simple calculator </title>
07
</Head>
08
<Body>
09
<H1> simple calculator 10
<Hr/>
11
<C: if test = "$ {param. ope = 'add'}">
12
$ {Param. number1} + $ {param. number2 }=$ {param. number1 + param. number2}
13
</C: if>
14
<C: if test = "$ {param. ope = 'minus'}">
15
$ {Param. number1}-$ {param. number2 }=$ {param. number1-param. number2}
16
</C: if>
17
<C: if test = "$ {param. ope = 'multiply'}">
18
$ {Param. number1} * $ {param. number2} =$ {param. number1 * param. number2}
19
</C: if>
20
<C: if test = "$ {param. ope = 'div '}">
21
$ {Param. number1}/$ {param. number2} =$ {param. number1/param. number2}
22
</C: if>
23
</Body>
24
</Html>
Here is an episode, under the WEB-INF folder, the lib directory must have the jstl. jar and standard. jar packages
From Zhang Dapeng's blog