2013-06-06 4 views
1

Uhhm, 예제 및 솔루션을 정적 HTML에 연결하는 방법에 대한 stackoverflow에서 따라 갔지만 mvc : resource를 넣을 때 내 다른 JSP는 볼 수 없습니다. 내가 MVC를 데려 갈 경우 : JSP는 again.here 볼 수있는 자원 내 디스패처-servlet.xml에 여기Spring 3.1.1 정적 HTML은 액세스 할 수 있지만 다른 JSP는 액세스 할 수 없습니다.

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:context="http://www.springframework.org/schema/context" 
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-3.0.xsd"> 

<mvc:resources mapping="/static/**" location="/static/"/> 


<context:component-scan base-package="com.samuel.controller" /> 
<bean id="viewResolver" 
    class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
    <property name="viewClass" 
     value="org.springframework.web.servlet.view.JstlView" /> 
    <property name="prefix" value="/WEB-INF/jsp/" /> 
    <property name="suffix" value=".jsp" /> 

</bean> 


</beans> 

것은

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" 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"> 
<servlet> 
    <servlet-name>dispatcher</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>2</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>dispatcher</servlet-name> 
    <url-pattern>*.htm</url-pattern> 
</servlet-mapping> 
<session-config> 
    <session-timeout> 
     30 
    </session-timeout> 
</session-config> 
<welcome-file-list> 
    <welcome-file>redirect.jsp</welcome-file> 
</welcome-file-list> 
</web-app> 

답변

0

당신이 당신의 JSP를 지정하려고 했 내 web.xml에있다 뷰 컨트롤러로?

<mvc:view-controller path="/" view-name="index"/>