이것은 web.xml이며 Intellij가 생성했기 때문에 정확해야합니다. 스프링 MVC에서 URI 매핑을 찾을 수 없습니다.
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="3.1">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>
</web-app>
이
은@Controller
public class IndexController {
@RequestMapping("/index")
public String index(ModelMap model) {
System.out.print("index");
return "index";
}
}
나는 인 IntelliJ에서 새 프로젝트를 만들
, 나는 이러한 옵션을 체크 컨트롤러입니다.Java EE > Web Application
> Spring MVC
> Hibernate
내가 사용하는 경우 내가 페이지를 올바르게
에 액세스 할 수 없습니다 "로컬 호스트 : 8080/테스트"
이 URL에 액세스하기 때문에 나는, 컨트롤러가 실행되지 않는 페이지를 볼 수 있지만 " 로컬 호스트 :/index.jsp를 localhost "를
내가 사용하는 경우"/ 테스트 8080 : 8080/테스트/지수 ", 결과는 404
내가 사용하는 경우"로컬 호스트 : 8080/테스트/지수 ", 결과는 404입니다 , 서버 이 오류
WARNING: No mapping found for HTTP request with URI [/test/index.form] in DispatcherServlet with name 'dispatcher'
나는 ".form"을 "/"변화를 보여줍니다 로그,하지만, 난 여전히 같은 오류가 발생했습니다.
내 프로젝트에 아직없는 것이 있습니까?
업데이트, 이러한 applicationContext.xml 및 디스패처-servlet.xml 파일이며,이 파일은
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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">
</beans>
디스패처-servlet.xml에
인 IntelliJ 에 의해 생성된다<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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">
</beans>
당신은 즉의 GET/POST, 메소드 레벨에서 방법의 유형을 넣어하려고 했습니까? – Neeraj
Dispatcher Spring Config를 게시 할 수 있습니까? 그리고 봄 버전이 사용 되나요? –
@Neeraj'method = RequestMethod.GET'을 시도했지만 작동하지 않습니다. –