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 !

..

Play Framework 完整实现一个APP(一)的更多相关文章

  1. Play Framework 完整实现一个APP(十一)

    添加权限控制 1.导入Secure module,该模块提供了一个controllers.Secure控制器. /conf/application.conf # Import the secure m ...

  2. Play Framework 完整实现一个APP(五)

    程序以及基本可用了,需要继续完善页面 1.创建页面模板 创建文件 app/views/tags/display.html *{ Display a post in one of these modes ...

  3. Play Framework 完整实现一个APP(二)

    1.开发DataModel 在app\moders 下新建User.java package models; import java.util.*; import javax.persistence. ...

  4. Play Framework 完整实现一个APP(十四)

    添加测试 ApplicationTest.java @Test public void testAdminSecurity() { Response response = GET("/adm ...

  5. Play Framework 完整实现一个APP(十三)

    添加用户编辑区 1.修改Admin.index() public static void index() { List<Post> posts = Post.find("auth ...

  6. Play Framework 完整实现一个APP(十二)

    1.定制CRUD管理页面 > play crud:ov --layout 替换生成文件内容 app/views/CRUD/layout.html #{extends 'admin.html' / ...

  7. Play Framework 完整实现一个APP(十)

    1.定制Comment列表 新增加Comment list页面,执行命令行 > play crud:ov --template Comments/list 会生成/app/views/Comme ...

  8. Play Framework 完整实现一个APP(九)

    添加增删改查操作 1.开启CRUD Module 在/conf/application.conf 中添加 # Import the crud module module.crud=${play.pat ...

  9. Play Framework 完整实现一个APP(八)

    创建Tag标签 1.创建Model @Entity @Table(name = "blog_tag") public class Tag extends Model impleme ...

  10. Play Framework 完整实现一个APP(六)

    需要为Blog添加 查看和发表评论的功能 1.创建查看功能 Application.java中添加 show() 方法 public static void show(Long id) { Post ...

随机推荐

  1. Socket开发框架之数据加密及完整性检查

    在前面两篇介绍了Socket框架的设计思路以及数据传输方面的内容,整个框架的设计指导原则就是易于使用及安全性较好,可以用来从客户端到服务端的数据安全传输,那么实现这个目标就需要设计好消息的传输和数据加 ...

  2. Ado.net[增删改查,GET传值]

    1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.c ...

  3. ASP.NET中的随机密码生成

    第一种方法:用.NET中的 Sytem.Guid.NewGuid().ToString() 生成,实际上是对一个128bit数字的十六进制输出.生成的字符由0-9和a-z这几种字符组成,也可能会有“- ...

  4. 【C#进阶系列】16 数组

    首先提一下,个人在项目中已经很少用到数组了,更多的时候使用List<>. 数组大小固定,如果只是用来存放数据,专门用来读取,更改当然方便.但是更多的时候我们需要进行增删改,这个时候用Lis ...

  5. 孙鑫MFC学习笔记11:保存图像

    1.CPtrArray指针数组 2.CPtrArray返回void指针,需要做类型转换 3.View类中的OnPaint调用OnPrepareDC和OnDraw,如果覆盖OnPaint,就不会调用On ...

  6. 指针,&的用法

    #include "stdafx.h" #include <stdio.h> #include <string.h> int main() { ] = {, ...

  7. [css] CSS3中的单位

    FROM http://www.qianduan.net/understand-the-unit-of-length-in-the-css.html CSS3中的单位: css3中引入了一些新的单位: ...

  8. windows / linux系统中,端口被占用解决方法

    一.在windows操作系统中,查询端口占用和清除端口占用的程序 提升权限后用:netstat -b或用 1.查询端口占用的进程ID 点击"开始"-->"运行&qu ...

  9. struts2输入验证

    1.方法     ① 基于Annotations的验证       ②基于XML配置的验证 http://blog.csdn.net/furongkang/article/details/692204 ...

  10. .net字符串数组查找方式效率比较

    下面是代码: static void Main(string[] args) { string[] arr = new string[] { "AAA", "BBBB&q ...