<html> | |
<head> | |
<title>Simple GroovyPages Example</title> | |
</head> | |
<body> | |
<h2 align="center">Simple Example</h2> | |
<table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4"> | |
<tr> | |
<td> | |
<i>Links:</i></td> | |
<td> | |
<i> | |
<a href="default.htm">Examples Home</a></i></td> | |
<td> | |
<i> <a href="simple.gsp">Simple Example</a></i></td> | |
<td> | |
<i> | |
<a href="visible.gsp?arg=This+is+a+test+argument&lastCount=${session.count}"> | |
Visible Syntax</a></i></td> | |
<td> | |
<i> | |
<a href="jsp.gsp?arg=This+is+a+test+argument&lastCount=<%=session.count%>"> | |
JSP Syntax</a></i></td> | |
</tr> | |
</table> | |
<p> This is a simple example of GroovyPages. This page | |
does the same thing as the <a href="simple.groovy">Groovlet Example</a>. | |
From the source code below, you can see that GroovyPages are very similar to JSP, | |
except much easier to use because Groovy is underneath.</p> | |
<%@ page import="java.util.Date" %> | |
<% if (session.count == null) session.count = 1 %> | |
<p>Hello, ${request.remoteHost}: ${session.count}! ${new Date()}</p> | |
<% session.count++ %> | |
<h3>The Source Code</h3> | |
<pre><html> | |
<head> | |
<title>Simple Example</title> | |
</head> | |
<body> | |
<span style="background-color: #99FF99"><%@ page import="java.util.Date" %></span> | |
<span style="background-color: #99FF99"><% if session.count == null | |
session.count = 1 %></span> | |
<p>Hello, <span style="background-color: #99FF99">${request.remoteHost}</span>: <span style="background-color: #99FF99">${session.count}</span>! <span style="background-color: #99FF99">${new Date()}</span></p> | |
<span style="background-color: #99FF99"><% session.count++ %></span> | |
</body> | |
</html></pre> | |
</body> | |
</html> |