Announcement Announcement Module
No announcement yet.
org.springframework.web.servlet.PageNotFound Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.web.servlet.PageNotFound

    Hi, everyone. I met a problem while i try to do something in the web mvc template sts provide.

    the web.xml file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns=""

    <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->

    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>

    <!-- Processes application requests -->
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>



    And the /WEB-INF/spring/appServlet/servlet-context.xml file is:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns=""

    <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    <resources mapping="/resources/**" location="/resources/" />

    <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    <beans:bean class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <beansroperty name="prefix" value="/WEB-INF/views/" />
    <beansroperty name="suffix" value=".jsp" />

    <beans:bean name="/home.htm" class="com.myresource.source.HomeController">
    <beansroperty name="greeting" value="Welcome here" />

    The com.myresource.source.HomeController class is :

    package com.myresource.source;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;

    * Handles requests for the application home page.
    public class HomeController implements Controller{

    private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

    private String greeting;

    public ModelAndView handleRequest(HttpServletRequest arg0,
    HttpServletResponse arg1) throws Exception {
    // TODO Auto-generated method stub
    return new ModelAndView("home","Message",greeting);

    public void setGreeting( String greeting ){
    this.greeting = greeting;

    the home.jsp page is :

    <%@ taglib uri="" prefix="c" %>
    <%@ page session="false" %>
    ${Messge }

    while i try to use http://localhost:8080/Fan/home.htm, i got 404 status.
    And the error log from tomcat is :

    org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/Fan/home.htm] in DispatcherServlet with name 'appServlet'

    It would be a great appreciation if u can give me some hint about that.

  • #2