Springs SimpleUrlHandlerMapping does not display my controller

I have the following mapping

<!-- URL Mapping  -->
    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/computing">computingController</prop>
                <prop key="/computing/login">computingLoginController</prop>
            </props>
        </property>
    </bean>

Unfortunately, if I open the URL http: // localhost: 8080 / sc2-master / computing / login , I get the following error:

15.09.2010 16:43:19 org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNUNG: No mapping found for HTTP request with URI [/sc2-master/computing/login] in DispatcherServlet with name 'computing'

My servlet is defined as follows:

<servlet>
        <servlet-name>computing</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>computing</servlet-name>
        <url-pattern>/computing/*</url-pattern>
    </servlet-mapping>

I can't figure out where the error is, but I think this is a simple problem ...

Thank you for your help!

Henry

+3
source share
1 answer

Try pointing the browser to http: // localhost: 8080 / sc2-master / computing / computing / login

The URL is based on the name of the web application followed by url-patternfollowed by matching requests from SimpleUrlHandlerMapping.

- /sc2-master, url-pattern /computing, SimpleUrlHandlerMapping /computing, /login.

+4

Source: https://habr.com/ru/post/1764905/


All Articles