File: temps.jsp

package info (click to toggle)
libbsf-java 1%3A2.3.0%2Bcvs20050308a-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,460 kB
  • ctags: 1,264
  • sloc: java: 7,643; cpp: 2,514; xml: 1,773; jsp: 463; ansic: 182; makefile: 61; python: 45; sh: 29
file content (123 lines) | stat: -rw-r--r-- 3,116 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<html>
<%@ taglib uri="http://jakarta.apache.org/taglibs/bsf-2.0" prefix="bsf" %>
<head>
   <title>Temperature Table</title>
</head>
<body>
<h1>Temperature Table</h1>
<p>American tourists visiting Canada can use this handy temperature
table which converts from Fahrenheit to Celsius:
<br><br>

In TCL
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="tcl">
  package require java

  for {set i 60} {$i<=100} {incr i 10} {
    $out println "<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">"
    $out println "<td>$i</td>"
    $out println [concat "<td>" [format %4.2f [expr ($i - 32.0)*5/9]] "</td>"]
    $out println "</tr>"
  }
</bsf:scriptlet>
</table>
<bsf:expression language="tcl">
    package require java ; java::new java.util.Date
</bsf:expression>


<hr>In Javascript
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="javascript">
  for (i=60; i<=100; i+=10) {
    out.println ("<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">")
    out.println ("<td>" +  i + "</td>")
    out.println ("<td>" + Math.round((i - 32)*5/9) + "</td>")
    out.println ("</tr>")
  }
</bsf:scriptlet>
</table>
<bsf:expression language="javascript"> new java.util.Date() </bsf:expression>

<hr>In Perl
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="perlscript">
  for ($i=60; $i<=100; $i+=10) {
    $out->println ("<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">");
    $out->println ("<td>$i</td>");
    $out->println ("<td>" . int(($i - 32)*5/9) . "</td>");
    $out->println ("</tr>");
  }
</bsf:scriptlet>
</table>
<bsf:expression language="perlscript"> CreateBean("java.util.Date") </bsf:expression>

<hr>In JACL
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="jacl">
package require java

for {set i 60} {$i<=100} {incr i 10} {
  $out println "<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">"
  $out println "<td>$i</td>"
  $out println [concat "<td>" [format %4.2f [expr ($i - 32.0)*5/9]] "</td>"]
  $out println "</tr>"
}
</bsf:scriptlet>
</table>


<hr>In JPython
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="jpython">
from java.util import Date;

for i in range(60,100,10):
  out.println ("<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">");
  out.println ("<td>%d</td>" % i);
  out.println ("<td>%4.2f</td>" % ((i - 32.0)*5/9));
  out.println ("</tr>");
</bsf:scriptlet>
</table>

<hr>In LotusScript
<table BORDER COLS=2 WIDTH="20%" >
<tr BGCOLOR="#FFFF00">
<th>Fahrenheit</th>
<th>Celsius</th>
</tr>
<bsf:scriptlet language="lotusscript">
for i = 60 to 100 step 10
    out.println "<tr ALIGN=RIGHT BGCOLOR=""#CCCCCC"">"
    out.println "<td>" &  i & "</td>"
    out.println "<td>" & format((i - 32)*5/9," 0.00") & "</td>"
    out.println "</tr>"
    next
</bsf:scriptlet>
</table>

<bsf:expression language="lotusscript"> CreateBean("java.util.Date") </bsf:expression>

</body>
</html>