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(一)的内容,更多相关内容请关注ki4网(www.ki4.cn)!