A blog engine project yabe.
1.创建工程
>play new yabe
设置Application Name: Yet Another Blog Engine.
2.创建Eclipse配置文件
>play eclipsify yabe
导入Eclipse
3.修改index.html
#{extends 'main.html' /} #{set title:'Home' /} <h1>A blog will be there</h1>
4.修改Application.java
public static void index() { System.out.println("Yop"); render(); }
运行测试,查看是否可用
5.设置数据库连接(本例使用的是PostgreSql),修改application.conf
db.driver=org.postgresql.Driver db.url=jdbc:postgresql://localhost:5432/postgre jpa.dialect=org.hibernate.dialect.PostgreSQLDialect db.user=##### db.pass=#####
运行程序,刷新页面,控制台出现以下提示,即为配置正确
INFO ~ Connected to jdbc:postgresql://localhost:5432/postgres for default
INFO ~ Application 'Yet Another Blog Engine' is now started !
..