Spring xml context

281
09 января 2017, 20:59

Совсем недавно я начал изучать Java, в конце курса мне дали задание написать небольшой (в сравнении с проектами компании) учебный проект. Когда мне рассказывали про spring, а именно про context.xml, на вопрос, а что здесь и как:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
   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-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

мне отвечали: так будет везде, пока забей! Так вот, теперь, мне надо добавить в свой проект AJAX, я взял пример отсюда, запусти его, он заработал. Пытаюсь то же самое сделать в моем проекте, не работает( Разница между проектами, только в этих xml.

Мой mvc-dispatcher-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
   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-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.luxoft.buying_currency.controllerUI" />
<!--<mvc:annotation-driven />-->
<!--<mvc:resources mapping="/**" location="/" />-->
<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/pages/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

servlet-context.xml из примера

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    <!-- 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.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>
    <context:component-scan base-package="com.blogspot.alexeydl" />
</beans:beans>

Естественно пути все меняю во второй xml на свои, вставляю к себе в проект, мой проект перестает работать, оставляю свою xml не работает AJAX. Мой проект

Как решить эту проблему? Времени читать про contxt.xml особо нету, по первым ссылкам в гугле не нашел.

READ ALSO
Как при нажатии на кнопку вызвать меню

Как при нажатии на кнопку вызвать меню

Вроде как на многих телефонах нет кнопки меню, а панель лепить не хочу, хочу вызывать меню при нажатии на ImageButtonКак под неё переделать эту...

294
Не выполняется конструктор

Не выполняется конструктор

Файл CleanBackupFoldersjava:

270