package com.hao.controller;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.hao.service.StudentService;
@Controller
public class StudentController {
@Autowired
private StudentService studentService;
@RequestMapping("list")
public ModelAndView list() {
ModelAndView mv = new ModelAndView();
List<Map<String , Object>> studentList = studentService.findStudentList();
System.out.println("studentList"+studentList);
mv.addObject("studentList",studentList);
mv.setViewName("list");
return mv;
}
@RequestMapping("toAdd")
public ModelAndView toAdd() {
ModelAndView mv = new ModelAndView();
mv.setViewName("add");
return mv;
}
}
尊严丢了,整个人就破产了。
《李茶的姑妈》
本文介绍了一个使用Spring框架实现的学生信息管理系统,系统包括学生信息的展示、添加等功能。通过StudentController类,利用注解方式实现了控制器的功能,能够从StudentService获取学生列表,并将其传递给视图进行显示。
799

被折叠的 条评论
为什么被折叠?



