javax.servlet.ServletException: Could not resolve view with name 'xxxxx'in servlet with name 'xxx'

来源:互联网 发布:php企业产品展示网站 编辑:程序博客网 时间:2024/06/05 00:29

在请求的返回值中加入 @ResponseBody



如果还是没有  

则需要对springMvc 配置文件进行配置

第一,springmvc的配置文件中

<bean id="freemarkerConfig"
  class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
  
<property name="templateLoaderPath" value="/templates/" />
  <property name="defaultEncoding" value="utf-8" />

    模版加载地址配置是否正确 value="/templates/"

     在controller中返回的页面地址需去掉默认加载路径 ( templates/login.ftl) 需去掉 templates


第二,返回json格式的数据的时候需注意 在配置文件中配置的

<property name="defaultContentType" value="text/html" />改为<property  name="defaultContentType"   value="application/json" />    




阅读全文
0 0
原创粉丝点击