step.txt 971 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
1. ҧ models -> Course.java
2. 
@Entity
public class Course {

    @Id
    public Long id;
    public String title;
    public String description;
    public static Finder<Long, Course> find = new Finder<>(Course.class);
    

}
<Long, Course> find = new Finder<>(Course.class);
3.  conf > evolutions > 2.sql  insert into course (id,title,description) values (  1,'Numertical Method', '͹');
delete from course;
4. ҧ CourseController.java 
    public Result course() {
        List<Course> courseList = Course.find.all();
        return ok(views.html.course.render(courseList));
    }
5. ҧ course.scala.html 
@(courseList: List[models.Course])
ǹ㹡ѹѾ
        @for(c <- courseList) {
            <tr>
                <td>@c.id</td>
                <td>@c.title</td>
                <td>@c.description</td>
            </tr>
          }
6. routes
GET     /course                          controllers.CourseController.course()