新手求救eclipse启动程序断点不停首页还是旧的,刷新页面才停并换成新的
最近在学习spring mvc
——————————Controller代码————————————————
package test.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
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 test.service.PersonService;
@Controller
public class PersonController {
@Autowired
private PersonService personService;
@RequestMapping("index")
public ModelAndView index(HttpSession session,HttpServletRequest request)
{
ModelAndView mav=new ModelAndView();//
断点在这行,启动应用断点不停,点右键刷新页面断点才停,控制台均没有报错
try
{
mav.setViewName("person");
}
catch(Exception e)
{
mav.setViewName("error");
}
return mav;
}
}
—————————————jsp代码———————————————————
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
person//
我把这个换成aaa,重启应用,结果显示的还是person,右键点刷新页面,才换成aaa
</body>
</html>
——————————————————————————
为什么右键刷新页面才调index方法?请各位大侠看看怎么回事,哪里设置的不对吗?
还有,我想在PersonController 里定义一个变量name=“abc”,然后传到前台显示,java文件和jsp文件分别需要写什么代码?
------解决方案--------------------