2017-10-19 1 views
0

나는 기본적인 스프링 웹 동적 프로젝트를 만들려고 노력하고있다.
다음은 스프링 라이브러리 목록입니다.
enter image description here'beans'요소의 선언을 찾을 수 없습니다. 봄에

그리고 이것은 내 HelloWeb-servlet.xml 코드입니다.

<?xml version="1.0" encoding="UTF-8"?> 
<beans 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/beans_4.0.xsd" 
     bean-discovery-mode="annotated"> 
    <context:component-scan base-package = "com.tutorialspoint" /> 
    <bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name = "prefix" value = "/WEB-INF/jsp/" /> 
     <property name = "suffix" value = ".jsp" /> 
    </bean> 
</beans> 


그리고 여기에 내 프로젝트 구조입니다. enter image description here

도와주세요. 고맙습니다.

+0

xmlns가 이상하게 보입니다. 일반적으로 다른 것이 있습니다. https://stackoverflow.com/questions/17822466/spring-beans-dtd-and-xmlns (예 : –

+0

@RC) –

답변

0

HelloWeb-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" 
    xsi:schemaLocation = "http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-4.0.xsd"> 

    <context:component-scan base-package = "com.tutorialspoint" /> 

    <bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name = "prefix" value = "/WEB-INF/jsp/" /> 
     <property name = "suffix" value = ".jsp" /> 
    </bean> 

</beans> 

이제 작동 중입니다.

관련 문제