2009-09-23 3 views
2

오류 메시지는 설명 The requested resource (/gradebook/WEB-INF/jsp/hello.jsp.jsp) is not available입니다. 나는 디렉토리에 hello.jsp을 가지고 있습니다. jsp 확장을 추가하는 것으로 보이는 스프링과 나는 이유를 알 수 없습니다. 내 web.xml과 내 gradebook-servlet.xml을 붙여 넣었습니다. 컨트롤러 반환의 이름을 무엇이든보기에 ".jsp로"접미사를 추가하도록 구성되어있는 InternalResourceViewResolver - 당신에게 말 했어요 때문에스프링 MVC가 사용자가 입력 한 URL에 .jsp 확장자를 추가하려고합니다.

<?xml version="1.0" encoding="UTF-8"?> 

<web-app 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" > 
    <servlet> 
    <servlet-name>gradebook</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
    <servlet-name>gradebook</servlet-name> 
    <url-pattern>*.htm</url-pattern> 
    </servlet-mapping> 
    <welcome-file-list> 
    <welcome-file> 
     *index.jsp* 
    </welcome-file> 
    </welcome-file-list> 
</web-app> 

<?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-2.5.xsd"> 
    <bean name="/hello.htm" class="gradebook.web.HelloController"/> 
<bean id="viewResolver" 
class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="viewClass"> 
     <value>org.springframework.web.servlet.view.JstlView</value> 
     </property> 
    <property name="prefix"> 
     <value>/WEB-INF/jsp/</value> 
    </property> 
    <property name="suffix"> 
     <value>.jsp</value> 
    </property> 
</bean> 
</beans> 

답변

3

봄 ".jsp로"를 추가하고있다.

HelloController 클래스가 핸들러 메소드에서 "hello.jsp"를 리턴하고 있다고 생각하십니까? 그것은 단지 "hello"를 돌려 주어야하고 Spring은 당신이 설정 한대로 ".jsp"를 추가 할 것입니다.

+0

감사합니다. 안녕하세요 .jsp를 hello로 변경하여 문제를 해결했습니다. – Jared

관련 문제