2017-04-09 4 views
0

正しいconfigure templateResolverに問題があります。私はデフォルトのページを取得しようとすると、うまく動作します。私はSpring templateResolverの設定

template might not exist or might not be accessible by any of the configured Template Resolvers 

ディスパッチャ-servlet.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" 
    xmlns:context="http://www.springframework.org/schema/context" 
    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/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context.xsd"> 
<mvc:annotation-driven/> 
<context:component-scan base-package="com.javapointers.controllers"/> 
<bean id="templateResolver" 
     class="org.thymeleaf.templateresolver.ServletContextTemplateResolver"> 
    <property name="prefix" value="/WEB-INF/pages/"/> 
    <property name="suffix" value=".html"/> 
    <property name="templateMode" value="HTML5"/> 
</bean> 
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> 
    <property name="templateResolver" ref="templateResolver"/> 
</bean> 
<mvc:resources mapping="/resources/**" location="/WEB-INF/resources/"/> 

にHomeController取得/ someAddressでページに移動しようとすると

@Controller 
public class HomeController { 

@RequestMapping(value="/", method = RequestMethod.GET) 
public String viewHome(){ 
    return "test"; 
} 

@RequestMapping(value="/login", method = RequestMethod.GET) 
public String login(){ 
    return "login"; 
} 

は誰が正しいのconfigureを知っていますか?

答えて

0

私はこの問題を解決しました。私のアプリケーションでは、Javaクラスの別の豆の設定でした。