Results 1 to 4 of 4
  1. #1
    rcclark is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Question No mapping found for HTTP request with URI - Why won't my page load?

    Hi, I am new to Spring and I can't get the configuration right so that my page comes up. I bet that it is a simple configuration problem but I have exhausted myself with internet searches, reading through and trying examples, reading and rereading the 2 Spring books that I have and still no luck. I am hoping that someone can point out my configuration problem.

    Thank you, here is my code:

    Java Code:
    My URL is:
    http://localhost:8080/DVDTracker5-0/searchMainView.htm
    
    web.xml:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 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">
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>
    
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    
        <servlet>
            <servlet-name>dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>dispatcher</servlet-name>
            <url-pattern>*.htm</url-pattern>
        </servlet-mapping>
    
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    
    dispatcher-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:tx="http://www.springframework.org/schema/tx"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/tx
            http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-3.1.xsd
        ">
    
        <tx:annotation-driven />
    
        <context:component-scan base-package="com.home.dvdtracker.controller" />
        <context:component-scan base-package="com.home.dvdtracker.service" />
    
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
    
        <bean id="viewResolver"
              class="org.springframework.web.servlet.view.InternalResourceViewResolver"
              p:prefix="/WEB-INF/jsp/"
              p:suffix=".jsp" />
    
    <!-- My Beans -->
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <props>
                    <prop key="/index.htm">indexController</prop>
                    <prop key="/mainPage.htm">mainPageController</prop>
                </props>
            </property>
        </bean>
     
        <bean name="indexController" 
                class="org.springframework.web.servlet.mvc.ParameterizableViewController">
            <property name="viewName" value="index" />
        </bean>
        <bean name="mainPageController" 
                class="org.springframework.web.servlet.mvc.ParameterizableViewController">
            <property name="viewName" value="mainPageView" />
        </bean>
    
    </beans>
    
    Controller:
    
    package com.home.dvdtracker.controller;
    
    import com.home.dvdtracker.service.SearchDvdServiceInt;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.ModelMap;
    import org.springframework.validation.BindingResult;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.support.SessionStatus;
    
    
    @RequestMapping("/searchMainView.htm")
    @Controller
    public class SearchMainController {
    
        @Autowired
        private SearchDvdServiceInt searchDvdService;
    
        @RequestMapping(method = RequestMethod.GET)
        public String setupForm(ModelMap uiModelMap) {
            return "searchMainView";
        }
    
        @RequestMapping(method = RequestMethod.POST)
        public String processSubmit(BindingResult result, SessionStatus status) {
            return "searchMainView";
        }
    }
    
    The JSP is /WEB-INF/jsp/searchMainView.jsp
    
    The index and main page come up fine, but when I click on the link to go to this search page I get a 404 not found.  Specifically:
    No mapping found for HTTP request with URI [/DVDTracker5-0/searchMain.htm] in DispatcherServlet with name 'dispatcher'|#]
    I appreciate it if someone can suggest what is wrong with my configuration.

    Thanks,
    Ray

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,862
    Rep Power
    19

    Default Re: No mapping found for HTTP request with URI - Why won't my page load?

    No mapping found for HTTP request with URI [/DVDTracker5-0/searchMain.htm]
    Your mapping appears to be for searchMainView.htm, not searchMain.htm.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    rcclark is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: No mapping found for HTTP request with URI - Why won't my page load?

    Quote Originally Posted by Tolls View Post
    Your mapping appears to be for searchMainView.htm, not searchMain.htm.
    Thank you for the reply. It doesn't matter which URL I use, searchMainView.htm or searchMain.htm, I get a page not found error.

    Ray

  4. #4
    rcclark is offline Member
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: No mapping found for HTTP request with URI - Why won't my page load?

    Thanks to all that read this thread. I found out what the problem was.

    I had:
    Java Code:
    <tx:annotation-driven />
    It should have been:
    Java Code:
    <mvc:annotation-driven />

Similar Threads

  1. HTTP request method associated with an URL
    By Sonal R N in forum Networking
    Replies: 0
    Last Post: 02-21-2011, 08:35 AM
  2. http request
    By nobleman_james in forum Java Applets
    Replies: 14
    Last Post: 12-17-2010, 07:23 PM
  3. Http request via applet
    By hoda in forum Java Applets
    Replies: 0
    Last Post: 11-20-2010, 10:07 AM
  4. Http request
    By arthik_babu in forum Advanced Java
    Replies: 2
    Last Post: 06-29-2009, 12:27 PM
  5. [SOLVED] http request
    By Eranga in forum Advanced Java
    Replies: 30
    Last Post: 11-27-2008, 04:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •