Spring mvc 的配置方法如下:
在src下添加springmvc-servlet.xml配置文件增加以下配置即可:
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.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">
这个跟spring mvc一样的啊,首先你看你的spring-mvc.xml 有没有配置defaultViewResolver,
然后你在action的方法中如果1.标注了@ResponseBody,返回字符串的话是通过write输出到页面。2.没有标注这个,spring mvc会到配置的目录下 找相应的jsp。比如返回 "hello",它就在 webpage/目录下找hello.jsp。 返回 "user/login",它就会找 webpage/user/login.jsp