发表于: 2018-03-07 20:20:01
1 530
今日完成
1.springMVC学习
搭建了SSM框架,开始利用任务一完成的sping+mybatis代码来尝试接口的实现;
写了下面一个controller:
@Controller
@RequestMapping("/user")
public class SpringController {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("com/student/StudentBeans.xml");
StudentMapper studentMapper= (StudentMapper) applicationContext.getBean("student");
/*
* 根据ID查询信息
* */
@RequestMapping(value = "/select",method = RequestMethod.GET)
public String select(int id, HttpServletRequest request) throws IOException {
Student student=studentMapper.findUserById(id);
request.setAttribute("student",student);
return "show";
}
输出结果
在查询中输入 3,点击提交后跳转页面
使用jetty的时候报错:
[ERROR] Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:8.1.16.v20140903:run (default-cli) on project SpringMVCStudy3: Failure: Address already in use: bind
原因是接口被占用,需要关闭相应接口,或者更换接口,这里使用的是8080接口
修改上图中的红色部分的数字,更改接口;
明天计划
1.继续完成上面的留下的部分;
遇到问题
1.jsp的学习缓慢,先完成其他部分;
2.jetty使用遇到问题,已经解决,解决方案在上面;
收获
评论