SlandShow
@SlandShow
70% of my body is made of movies.

Почему контроллер не принимает запрос?

Вот структура моего проекта:
5b82a042adcc5414618741.jpeg

У меня есть web.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<web-app version="3.1"
         xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

    <display-name>Java School 2018</display-name>

    <!-- ====Spring MVC Configs==== -->

    <!-- 1-st Step: Configure Spring MVC Front Controller (Dispatcher Servlet) -->
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

        <init-param>
            <param-name>contextConfigLocation</param-name>
            <!-- Here we reference to xml context config, where we can set up db (for example) and etc -->
            <param-value>/WEB-INF/spring-mvc-servlet.xml</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Step 2-nd: Set up URL mappings to Spring MVC Dispatcher Servlet -->
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <!-- For default, we handle all request via Front Controller (Dispatcher Servlet) -->
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>


У меня есть конфиг контекста:
<?xml version="1.0" encoding="UTF-8" ?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- ====Spring MVC Context (Bean IOC Factory) config==== -->

    <!-- Step 3-rd: Add support for component scanning -->
    <context:component-scan base-package="com.slandshow"/>

    <!-- Step 4-th: Add support for conversion, formatting and validation support -->
    <mvc:annotation-driven/>

    <!-- Step 5: Define Spring MVC view resolver -->
    <bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view"/>
        <property name="suffix" value=".jsp"/>
    </bean>

</beans>


У меня есть JSP:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h2>Java School</h2>
</body>
</html>


У меня есть контроллер:
@Controller
public class HomeController {

    // JSP views
    private static final String MAIN_PAGE = "main-menu";

    // Handle root request
    @RequestMapping("/")
    public String showHomePage() {
        return MAIN_PAGE;
    }

}


И я получаю проблему:
Type Status Report

Message /

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Что не так?
  • Вопрос задан
  • 68 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
Bell Integrator Хабаровск
До 400 000 ₽
Bell Integrator Ульяновск
До 400 000 ₽
Bell Integrator Ижевск
До 400 000 ₽
18 мая 2024, в 16:18
1500 руб./в час
18 мая 2024, в 16:09
4000 руб./за проект