@Trans00
Java-разработчик

Почему Spring mvc на embedded jetty не видит.jsp файлов?

Получаю эту ошибку снова и снова
web.xml
<web-app id="WebApp_ID" version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
	http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>brb</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

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

    <servlet-mapping>
        <servlet-name>brb</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
</web-app>

brb-servlet.xml

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

    <context:component-scan base-package="spring"/>

    <mvc:annotation-driven/>

    <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="prefix" value="" />
        <property name="suffix" value="" />
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    </bean>

    <bean name="simple" class="spring.SimpleBean">
        <constructor-arg index="0" value="1"/>
        <constructor-arg index="1" value="1"/>
    </bean>

</beans>


Controller:
public class BrbController{


    @RequestMapping(value = "/", method = GET)
    public String index() {
        System.out.println(this.getClass().getClassLoader().getResource("index.jsp")); // Проверяю доступен ли файл, хотя и добавил его в каждую папку ресурсов
        return "index.jsp";
    }

Я пытаюсь поднять этот микросайтик под embedded jetty.
для проверки вызываю "localhost:1234/"
  • Вопрос задан
  • 2679 просмотров
Пригласить эксперта
Ваш ответ на вопрос

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

Войти через центр авторизации
Похожие вопросы
Искра Екатеринбург
от 80 000 до 100 000 ₽
Art gorka Санкт-Петербург
от 60 000 ₽
28 апр. 2024, в 13:37
15000 руб./за проект
28 апр. 2024, в 13:15
80000 руб./за проект