创建一个简单的helloword之后修改routes文件,添加三条新路径,如果现在就启动会报错,
# Home page
GET / controllers.Application.index()
GET /jump controllers.Application.jump()
GET /addUser controllers.Application.addUser()
GET /findUserList controllers.Application.findUserList()
POST /deleteU/:id/delete controllers.Application.deleteU(id: Integer)
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
这时候需要在Application.java中添加三个对应的方法,暂时不做任何处理直接返回页面(如果访问http://localhost:9000 会一直在routes找 / 进入index方法,这时候想跳到其他方法可以用redirect )
public static Result index() {
System.out.println("进入index");
return redirect(routes.Application.jump());
}
public static Result jump(){
System.out.println("进入jump成功!");
return TODO;
}
public static Result addUser(){
return TODO;
}
public static Result deleteU(int id){
return TODO;
}
public static Result findUserList(){
return TODO;
}
model中添加实体类User.java 在实体类中添加静态的增删改查方法,方便后面用到
package models;
import