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 !
..
以上就是playframework完整实现一个app(一)的内容。