读书人

新手eclipse启动程序断点不停首页还是

发布时间: 2013-07-20 11:07:48 作者: rapoo

新手求救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文件分别需要写什么代码?


xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
metadata-complete="true">

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml,
/WEB-INF/config/applicationContext-*.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<servlet>
<servlet-name>shwtest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>shwtest</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>

——————————————test-servlet.xml————————————————————————
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<mvc:annotation-driven />

<context:component-scan base-package="test.web"></context:component-scan>

<bean alt="新手eclipse启动程序断点不停首页还是旧的,刷新页面才停并换成新的" />
缓存的存在是为了提高访问速度。
楼主如果不想每次都设置的话,修改一下浏览器设置默认不保存缓存应该就行了。。
每种浏览器设置方式不一样,这个百度下吧

读书人网 >J2EE开发

热点推荐