Groovlets (groovy servlet) 的 helloword


需要
Groovy Version: 1.5.0
resin pro 3.1.4
groovy的安装,略

启动resin后,会有一个%RESIN_HOME%\webapps\ROOT\WEB-INF\web.xml文件。
增加如下内容
[code lang=”xml” linenum=”off”]
GroovyServlet
groovy.servlet.GroovyServlet


GroovyTemplate
groovy.servlet.TemplateServlet


GroovyServlet
*.groovy


GroovyTemplate
*.gsp
[/code]
copy %GROOVY_HOME%\lib\下的
groovy-1.5.0.jar
asm-2.2.jar
antlr-2.7.6.jar

%RESIN_HOME%\lib
启动resin,在
%RESIN_HOME%\webapps\ROOT下新建2个文件
hello.gsp
————-
[code lang=”” linenum=”off”]<% def h="hello" def w="world" println "$h $w" print 2+2 println " times" %>[/code]

hello.groovy
——-
[code lang=”” linenum=”off”]println “””


Groovy Servlet


Hello world @ ${new Date()}


“””[/code]

运行后
http://localhost:8080/1.gsp
http://localhost:8080/a.groovy
的内容分别为
hello world 4 times
Hello world @ Thu Dec 13 23:04:18 CST 2007


《“Groovlets (groovy servlet) 的 helloword”》 有 1 条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注