发表于: 2017-05-11 21:32:13

3 1358


今天完成的任务:

    1.收尾任务五,调试的时候解决了一点小bug.

报错原因是 

   @RequestMapping(value = "/home", method = RequestMethod.GET)

    public String index(Model model, HttpServletRequest request) throws Exception {

        List<Student> studentList = studentService.query();

    @RequestMapping(value = "/home", method = RequestMethod.GET)

    public String home(Model model) {

         return "home";

    }

重复了,导致spring无法初始化报错入下:

2:02(FrameworkServlet.java:457)[ERROR] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'studentController' bean method 

public java.lang.String com.jnshu.rest.demo2.controller.StudentController.home(org.springframework.ui.Model)

to {[/home],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'studentController' bean method

public java.lang.String com.jnshu.rest.demo2.controller.StudentController.index(org.springframework.ui.Model,javax.servlet.http.HttpServletRequest) throws java.lang.Exception mapped.

大家一定要细心啊,这要是从报错找毛病怎么也联系不到是  @RequestMapping(value = "/home"重复了.计算机真的很笨的.它不会和你说你这里重复了什么的?当然经验多了也会一下就找到.报一次错就会涨一点经验.

    2.探究org.springframework.web.servlet.ModelAndView;发现Model指的是从后台取到的数据.View指的是前端的jsp字段.但是它如何从后端传到前端,编程jsp页面显示的数值呢.它的过程如何实现的?

另外org.springframework.ui.Model;这个接口是如何实现的?

    3.晚上查找任务六相关资料,尝试再任务五整合Memcach.参与永刚的分享主要涉及下面几块内容,同时自己对任务三的理解也比较有条理了.记下来方便以后复习

 a.代码部署服务器
jar包,war包,package阶段生成
maven生命周期(三个)
如何跳过测试步骤
命令jar:jar

jar:test-ja

b.反向代理

隐藏IP地址
配置缓存加速访问
静态资源缓存
负载均衡
轮询调度算法
IP_hash
wait权重算法

c.shell脚本文件

遇到的问题:

    编码不求甚解,可能还没有打那个阶段吧,Model和ModelAndVies,现在只是知道可以和jsp页面交互,具体如何实现还不明白,心里有点小痒痒.

收获:

    分享果然是个好东西,可以锻炼自己表达能力,还能深度思考,加深理解.加油!

明天的计划:

    下载JMeter,调试运行压测自己的JSP,查看TPS数据.





返回列表 返回列表
评论

    分享到