src/com/stusystem/controller/ScoreController.java

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.stusystem.controller;

import java.io.IOException;
import java.net.URLDecoder;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.stusystem.dao.ScoreDao;
import com.stusystem.dao.StudentDao;
import com.stusystem.entity.ScoreBean;
import com.stusystem.entity.StudentBean;
import com.stusystem.entity.SubjectBean;

@Controller
@RequestMapping(value = "score")
public class ScoreController {
	@Autowired
	private StudentDao studentDao;
	//要注入必须要将这个类在spring容器中注册
	@Autowired
	private ScoreDao scoreDao;
//	ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-context.xml");
//	StudentDao studentDao = (StudentDao) applicationContext.getBean("studentDao");
//	ScoreDao scoreDao = (ScoreDao) applicationContext.getBean("scoreDao");
	//查询出所有学生信息到学生成绩管理页面
	@RequestMapping(value = {"/scorelist"})
	public String getStudent(StudentBean stu,Model model) throws Exception{
		if(stu.getStuName()!=null&&stu.getStuName()!=""){
			stu.setStuName(URLDecoder.decode(stu.getStuName(), "UTF-8"));
		}
		List<StudentBean> stulist = studentDao.getStudent(stu);
		int stupage = studentDao.getstupage(stu);
		model.addAttribute("studentlist", stulist);
		model.addAttribute("stupage", stupage);
		model.addAttribute("studentname", stu.getStuName());
		return "scorelist";
	}
	//查询出一个学生已选课程信息list到该学生成绩编辑页面
	@RequestMapping(value = {"/scoreeditor"})
	public String scoreeditor(StudentBean stu,Model model) throws Exception{
		List<ScoreBean> scorelist = scoreDao.getscorelist(stu);
		model.addAttribute("scorelist", scorelist);
		if(scorelist.size()==0){
			model.addAttribute("h1", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这位同学还没有选课!!!");
		}
		return "scoreeditor";
	}
	//得到在编辑页面编辑好一个学生的各科成绩的list,循环存入数据库中后,在返回存入结果
	@RequestMapping(value = {"/scoreadd"})
	public void scoreadd(String scorelist,HttpServletResponse response) throws IOException {
		int a = 0;
		String[] scoreStrArray = scorelist.split(",");
		ScoreBean score = new ScoreBean();
		try{
后面还有 77 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。