404 в mvc, spring, java

110
20 августа 2019, 00:10

Точно такой же проект с другим названием работает. Имею MVC. UserController

 @Controller
@RequestMapping("/users")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public @ResponseBody
    List<User> getAllUsers() {
        return userService.getAllUsers();
    }
    @RequestMapping(value = "/validate", method = RequestMethod.GET)
    public ModelAndView validateUser() {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("userFromServer", new User());
        modelAndView.setViewName("users_check_page");
        return modelAndView;
   }
    @RequestMapping(value = "/check", method = RequestMethod.POST)
    public @ResponseBody
    String checkUser(@ModelAttribute("userFromServer") User user) {
        if ("admin".equals(user.getName()) && "admin".equals(user.getPassword())) {
            return "valid";
        }
        return "invalid";
    }
}

pom.xml

 <build>
        <finalName>FirstAppwithJetty</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.2.11.v20150529</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <httpConnector>
                        <port>9751</port>
                    </httpConnector>
                    <webApp>
                        <contextPath>/user-system</contextPath>
                    </webApp>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

spring-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.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.xsd">
    <mvc:annotation-driven/>
    <context:component-scan base-package="system"/>
    <mvc:view-controller path="/" view-name="users_page"/>
    <mvc:view-controller path="/test/" view-name="test"/>
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
</beans>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
         version="3.0">
    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/spring-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

Еще jsp страница

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<spring:form modelAttribute="userFromServer" method="post" action="/user-system/users/check">
    <spring:input path="name"/>
    <spring:input path="password"/>
    <spring:button>check user</spring:button>
</spring:form>
</body>
</html>

Такая структура у моего проекта 1:

Запускаю maven: cleane package jetty:run Но получаю 404

Что делать не знаю!

log

jetty:run
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building MvcTestProject 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ MvcTestProject ---
[INFO] Deleting V:\ProjectJAVA\MvcTestProject\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MvcTestProject ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ MvcTestProject ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to V:\ProjectJAVA\MvcTestProject\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MvcTestProject ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory V:\ProjectJAVA\MvcTestProject\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ MvcTestProject ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MvcTestProject ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MvcTestProject ---
[INFO] Building jar: V:\ProjectJAVA\MvcTestProject\target\FirstAppwithJetty.jar
[INFO] 
[INFO] >>> jetty-maven-plugin:9.2.11.v20150529:run (default-cli) > test-compile @ MvcTestProject >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MvcTestProject ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ MvcTestProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MvcTestProject ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory V:\ProjectJAVA\MvcTestProject\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ MvcTestProject ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< jetty-maven-plugin:9.2.11.v20150529:run (default-cli) < test-compile @ MvcTestProject <<<
[INFO] 
[INFO] --- jetty-maven-plugin:9.2.11.v20150529:run (default-cli) @ MvcTestProject ---
[INFO] Logging initialized @4543ms
[INFO] Configuring Jetty for project: MvcTestProject
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] webAppSourceDirectory V:\ProjectJAVA\MvcTestProject\src\main\webapp does not exist. Trying V:\ProjectJAVA\MvcTestProject\target\webapp-tmp
[INFO] Reload Mechanic: automatic
[INFO] Classes = V:\ProjectJAVA\MvcTestProject\target\classes
[INFO] Context path = /user-system
[INFO] Tmp directory = V:\ProjectJAVA\MvcTestProject\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = null
[INFO] Webapp directory = V:\ProjectJAVA\MvcTestProject\target\webapp-tmp
[INFO] jetty-9.2.11.v20150529
[INFO] No Spring WebApplicationInitializer types detected on classpath
[INFO] Started o.e.j.m.p.JettyWebAppContext@f245bdd{/user-system,file:/V:/ProjectJAVA/MvcTestProject/target/webapp-tmp/,AVAILABLE}{file:/V:/ProjectJAVA/MvcTestProject/target/webapp-tmp/}
[WARNING] !RequestLog
[INFO] Started ServerConnector@1a0f349{HTTP/1.1}{0.0.0.0:9751}
[INFO] Started @9771ms
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.
READ ALSO
Создание HashMap из List с использованием valueMapper

Создание HashMap из List с использованием valueMapper

Есть метод, которому в параметре передается список строк (List<String>), из этого списка мне необходимо составить Map<String,Long>, где ключом(key)...

111
Как рисовать картинки при помощи батча и в той же сцене отрисовывать tiledmap через OrthogonalTiledMapRenderer в libgdx?

Как рисовать картинки при помощи батча и в той же сцене отрисовывать tiledmap через OrthogonalTiledMapRenderer в libgdx?

Когда я пытають отрисовать tiledmap и после этого рисую texture (batchdraw("объект Texture")) я вижу только tiledmap

97
как в React js передать свойство элементу onClick или onKeyUp?

как в React js передать свойство элементу onClick или onKeyUp?

вчера начал смотреть React JS, создал скрипт, который просто добавляет на страницу таблицу с input'амиНо мне надо на эти импуты еще повесить событие,...

135