💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
按规范,我们开发后台。 新建 TeacherAction,并给teachers变量,开发all()函数。 ``` package com.mengyunzhi.javaee.action; import java.util.ArrayList; import java.util.List; import com.mengyunzhi.javaee.dao.TeacherDao; import com.mengyunzhi.javaee.entity.Teacher; public class TeacherAction extends Action{ private static final long serialVersionUID = 1L; // 定义教师列表 private List<Teacher> teachers = new ArrayList<Teacher>(); public List<Teacher> getTeachers() { return teachers; } @SuppressWarnings("unchecked") public String all() { // 获取所有数据 TeacherDao teacherDao = new TeacherDao(); this.teachers = (List<Teacher>) teacherDao.all(); return SUCCESS; } } ``` 测试: ![https://box.kancloud.cn/2f8b3a8bd889cbf2b2f6738ebb55d667_1070x1156.png](https://box.kancloud.cn/2f8b3a8bd889cbf2b2f6738ebb55d667_1070x1156.png)