<bean id="KradWebMvcConfigurer" class="org.kuali.rice.krad.web.config.KradWebMvcConfigurer"> <property name="viewResolvers"> <list> <bean class="org.kuali.rice.krad.web.mvc.KradViewResolver"> <property name="order" value="0"/> <property name="viewClass" value="org.kuali.rice.krad.web.mvc.KradModelAndView"/> </bean> </list> </property> </bean> public class Student { private String id; private String name; private int age; // getters and setters } html <!DOCTYPE html> <html> <head> </head> <body> <table> <thead> <tr> <th>ID</th> </tr> </thead> <tbody> <c:forEach items="${students}" var="student"> <tr> <td>${student.id}</td> <td>${student.name}</td> <td>${student.age}</td> </tr> </c:forEach> </tbody> </table> </body> </html> @Controller @RequestMapping("/students") public class StudentController { @Autowired private StudentService studentService; @RequestMapping("/list") public String list(Model model) { List<Student> students = studentService.getStudents(); model.addAttribute("students", students); return "student-list"; } }


上一篇:
下一篇:
切换中文