问答详情
源自:-

Could not resolve view with name 'list' in servlet with name 'seckill-dispatcher'如何解决

Could not resolve view with name 'list' in servlet with name 'seckill-dispatcher'如何解决


public String list(Model model) {


List<Seckill> list = seckillService.getSeckillList();

model.addAttribute("list", list);

//测试

return "list";

}   测试部分 ,方法进入执行,最后return的时候  servlet 找不到list   


提问者:攻城狮Flion 2017-11-02 17:03

个回答

  • 轼佣
    2018-03-28 23:58:50

    <!-- 配置jsp显示ViewResolver -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
       <property name="viewNames" value="org.springframework.web.servlet.view.JstlView" />
       <property name="prefix" value="/WEB-INF/jsp/"/>
       <property name="suffix" value=".jsp" />
    </bean>

    你看看你的viewNames是不是配置错误了。。

  • 轼佣
    2018-03-28 23:33:32

    你要看看你的jsp文件是否放在WEB-INF/jsp文件夹下面。

  • 攻城狮Flion
    2017-11-02 17:07:31

    <servlet>

    <servlet-name>seckill-dispatcher</servlet-name>

    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <init-param>

    <param-name>contextConfigLocation</param-name>

    <param-value>classpath:spring/spring-*.xml</param-value>

    </init-param>

    </servlet>

    <servlet-mapping>

    <servlet-name>seckill-dispatcher</servlet-name>

    <url-pattern>/</url-pattern>

    </servlet-mapping>