用到springMVC+freemarker,自己在做demo过程中报:

严重: Servlet.service() for servlet springmvc threw exception

javax.servlet.ServletException: Could not resolve view with name 'userlist' in servlet with name 'springmvc'

at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1102)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:890)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:851)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:756)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)

at

<!-- Freemarker配置 -->  
    <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">  
        <property name="templateLoaderPath" value="/WEB-INF/views/" />  
        <property name="freemarkerSettings">  
            <props>  
                <prop key="template_update_delay">0</prop>  
                <prop key="default_encoding">UTF-8</prop>  
                <prop key="number_format">0.##########</prop>  
                <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>  
                <prop key="classic_compatible">true</prop>  
                <prop key="template_exception_handler">ignore</prop>  
            </props>  
        </property>  
    </bean>  
    <!--freemarker视图解析器-->  
    <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">  
        <property name="cache" value="true"/>
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".html"/>
        <property name="contentType" value="text/html;charset=UTF-8" />
        <!--if you want to use the Spring FreeMarker macros, set this property to true-->
        <property name="exposeSpringMacroHelpers" value="true"/>
        <property name="requestContextAttribute" value="requestContext" />

</bean>


 问题解决:
因为freemarker本身配置了templateLoaderPath而在viewResolver中不需要配置prefix。

springMVC+freemarker中Could not resolve view with name... 问题解决的更多相关文章

  1. 【转】idea中applicationContext-trans.xml中的Cannot resolve bean 'dataSource'...的问题解决

    问题如下: (applicationContext-trans.xml中的部分截图) 先了解问题是怎么出现的: 此处的dataSource是在applicationContext-dao.xml中配置 ...

  2. idea中applicationContext-trans.xml中的Cannot resolve bean 'dataSource'...的问题解决

    问题如下: (applicationContext-trans.xml中的部分截图) 先了解问题是怎么出现的: 此处的dataSource是在applicationContext-dao.xml中配置 ...

  3. freemarker学习 (servlet + freemarker -> Struts2+freemarker -> springMVC+freemarker)

    什么是freemarker? freemarker类似于jsp,但不是jsp!怎么说呢?freemarker文件后缀是.ftl,它不像jsp本质是servlet,它将构建模板.解析模板.使用模板分离开 ...

  4. SpringMVC+Freemarker+JSTL支持

    前提: 网页编程中,我的思路是,通用的模块不仅仅只有后台代码,前端页面也可以独立为模块. 这个和asp.net中的UserController很像 比如有个人员基本信息的展示界面,需要在多个界面中嵌入 ...

  5. sonne_game网站开发03 spring-mvc+freemarker整合

    今天的任务就是在spring+mybatis+springmvc的基础上,将freemarker整合进来. freemarker是什么? freemarker是一种模板引擎.它的目的是基于模板和数据, ...

  6. Could not resolve view with name '***' in servlet with name 'dispatcher'

    今天在开发中遇到了一个问题,控制层使用的是SpringMVC框架. @RequestMapping("historyDetail") private String History( ...

  7. spring-mvc+freemarker整合(sonne_game网站开发03)

    今天的任务就是在spring+mybatis+springmvc的基础上,将freemarker整合进来. freemarker是什么? freemarker是一种模板引擎.它的目的是基于模板和数据, ...

  8. Spring mvc-异常javax.servlet.ServletException: Could not resolve view with name 'xxx' in servlet with name 'spring'

    最近使用spring mvc开发项目,遇到一个问题: javax.servlet.ServletException: Could not resolve view with name 'ok' in ...

  9. freemarker中使用<@spring.*>标签实现国际化

    freemarker实现国际化使用自定义指令<@spring>实现,通过@符号可以看出是自定义的指令,在哪里定义的呢? 路径如下:org/springframework/spring-we ...

随机推荐

  1. VisualStudio替换所有空行

    [一篮饭特稀原创,转载请注明出自http://www.cnblogs.com/wanghafan/p/3371620.html] Ctrl+Shift+H 查找内容\r\n\r\n   //如果要替换 ...

  2. [转贴]Windows下gSoap交叉编译环境的搭建

    本人直接就用过gSoap,它是用以C/C++写webservice的利器     交叉编译的时候,有两个很关键的程序:         soapcpp2.exe         wsdl2h.exe ...

  3. 让你的短信应用迎接Android 4.4(KitKat)

    原文地址:Getting Your SMS Apps Ready for KitKat 发送和接收短信是手机最基本的功能,很多的开发者也开发了很多成功的应用来增强Android这一方面的体验.你们当中 ...

  4. C 语言字符串(译)

    C 语言的 switch 语句非常强大.然而,它不能用字符串作为判断条件,只能用常整数.这是可以理解的,因为 C 的字符串仅仅是数组,它们并不是并不是一个整体. 在某些情况下,将 string 作为 ...

  5. ☀【Grunt】package.json, Gruntfile.js, npm install, grunt

    npm install --registry http://registry.npm.taobao.org/ 切换源 Grunt.js 在前端项目中的实战http://beiyuu.com/grunt ...

  6. [PeterDLax著泛函分析习题参考解答]第3章 Hahn-Banach 定理

    1. 证明 $(10'$). 证明: $\ra$: 由 $p_K(x)<1$ 知 $$\bex \exists\ 0<a<1,\st \cfrac{x}{a}\in K. \eex$ ...

  7. vim/Gvim配置

    " Sections:" -> General" -> VIM user interface" -> Colors and Fonts&quo ...

  8. HDU- Who Gets the Most Candies?

    Who Gets the Most Candies? Time Limit : 10000/5000ms (Java/Other)   Memory Limit : 262144/131072K (J ...

  9. 洛谷P1407 工资

    洛谷P1407 工资 本题地址:http://www.luogu.org/problem/show?pid=1407 题目描述 有一家世界级大企业,他们经过调查,发现了一个奇特的现象,竟然在自己的公司 ...

  10. JavaScript高级程序设计49.pdf

    HTML5事件 contextmenu事件 contextmenu事件是冒泡的,可以将事件处理程序指定到document,这个事件的目标是用户操作的元素,在兼容DOM的浏览器中使用event.prev ...