<!-- 启动SpringMVC的注解功能,它会自动注册HandlerMapping、HandlerAdapter、ExceptionResolver的相关实例 -->
<mvc:annotation-driven />
<mvc:default-servlet-handler />
<!-- 启动Spring的组件自动扫描机制 -->
<context:component-scan base-package="com.usoft.synusn.controller"></context:component-scan>
<!--通用视图解析器 -->
<bean id="viewResolverCommon"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="order" value="1" />
</bean>
<!-- SpringMVC的前端控制器 -->
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>classpath*:applicationcontext-webmvc.xml,classpath*:applicationcontext-freemarker.xml</param-value> -->
<param-value>classpath*:applicationcontext-web.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<!-- 由SpringMVC拦截所有请求 -->
<url-pattern>/</url-pattern>
</servlet-mapping>
/**
* freemarker控制器
* @author
*
*/
@Controller
public class FreeMarkerControler {
@RequestMapping("/hello")
public String sayHello(ModelMap map) {
System.out.println("say Hello ……");
map.addAttribute("message", "Hello World,FreeMarker!");
return "test";
}
}
This is my profile and controller, I did not find anything wrong , you can always No mapping found for HTTP request with URI
------ Solution --------------------------------------------
to < ; url-pattern> / * try it.
------ Solution ---------------------------------------- ----
you visit the url is what
------ Solution --------------------------- -----------------
@ RequestMapping ("/ hello") / / here should be a hello, should not be / it.
------ Solution ---------------------------------------- ----
multi-view to configure multiple DispatcherServlet job.
------ Solution ---------------------------------------- ----
certainly not normal. No deployed
------ Solution ------------------------------------- -------
http://www.cnblogs.com/penguin-panda/archive/2011/07/09/2101880.html
------ For reference only --- ------------------------------------
I would like to ask for ,
------ For reference only --------- ------------------------------
I changed , even the home are unable to visit the
------ For reference only ---------------------------------- -----
http://localhost:8080/spring_mybatis/hello
------ For reference only ---------------------------------- -----
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/7.0.32
This is my error page
------ For reference only ---------------------------- -----------
fact, my original view resolver is configured and jsp freemarker parser , equipped with two , freemarker the order is 0, jsp 's order is one , to achieve different view resolution , there is always a mistake I said , no way, I changed a single jsp view resolution , or that mistake , really no way
------ For reference only ------ ---------------------------------
not think so , there should be a DispatcherServlet. Multi-view is to configure multiple view resolvers it right . There is also a case ah , I publish my project , WEB-INF/class folder is empty, the normal right , this situation ?
------ For reference only -------------------------------------- -
not be the reason for it
I just normal deployment ah, myeclipse in , how do
------ For reference only -------------------- -------------------
forgot to say , I was using maven to build the project, and then according to the general project published in tomcat myeclipse
------ For reference only ---------------------------------------
------ For reference only ---- -----------------------------------
brother, I also have this problem , the solution of the do ? Seeking help ! QQ 393922808
------ For reference only ----------------------------------- ----
I am also the same problem ah , tangled waited a long time
------ For reference only ------------------ ---------------------
configuration view when last there is a slash in RequestMapping annotations without writing slash the
没有评论:
发表评论