1 |
ruleset first_jsp { |
2 |
meta { |
3 |
shares hello |
4 |
} |
5 |
global { |
6 |
hello = function(){ |
7 |
num = random:number(0,1) |
8 |
requestURI = "hello.html" |
9 |
<<<!doctype html> |
10 <html> |
<html> |
11 <head><title>First JSP</title></head> |
<head><title>First JSP/KRL</title></head> |
12 <body> |
<body> |
13 <% |
|
14 double num = Math.random(); |
|
15 if (num > 0.95) { |
#{ (num > 0.95) => << |
16 %> |
|
17 <h2>You'll have a lucky day!</h2><p>(<%= num %>)</p> |
<h2>You'll have a lucky day!</h2><p>(#{num})</p> |
18 <% |
|
19 } else { |
>> | << |
20 %> |
|
21 %> |
|
22 <h2>Well, life goes on ... </h2><p>(<%= num %>)</p> |
<h2>Well, life goes on ... </h2><p>(#{num})</p> |
23 <% |
|
24 } |
>>} |
25 %> |
|
26 <a href="<= request.getRequestURI() %>"><h3>Try Again</h3></a> |
<a href="#{requestURI}"><h3>Try Again</h3></a> |
27 </body> |
</body> |
28 </html> |
</html> |
29 |
>> |
30 |
} |
31 |
} |
32 |
} |