因为Web Module的.war文件,会在应用服务器上展开.所以如果在jsp或Groovy的脚本中有打开文件的操作.打开文件的目录的写法要注意.
import java.util.Date
import java.io.File;
if (session.counter == null) {
session.counter = 1
}
out.println(<<<EOS
<html>
<head>
<title>Groovy Servlet</title>
</head>
<body>
Hello, ${request.remoteHost}: ${session.counter}! ${new Date()}
<br>src
</body>
</html>
EOS)
session.counter = session.counter + 1
//研究了许久.:(,如何打开一个脚本文件
File fl=new File(application.getRealPath("/groovy/HelloWorld.groovy"))
evaluate(fl)