为啥是404?

来源:3-5 Hello Spring MVC

键盘兔

2016-03-30 17:22

问题一 项目jsp会报错 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
解决办法:web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Apache tomcat  7.0 -》finish

问题二 有两个包需要加,不然会报错。教程里没有说。

failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

解决:

<!-- JstlView必须的两个jar -->

<dependency>

   <groupId>jstl</groupId>

   <artifactId>jstl</artifactId>

   <version>1.2</version>

</dependency>

<dependency>

   <groupId>taglibs</groupId>

   <artifactId>standard</artifactId>

   <version>1.1.2</version>

</dependency>

问题三 访问路径 在tomcat里必须要有项目名称 不然会404(教程里是http://localhost:8080/hello/mvc)

应该是http://localhost:8080/spring-mvc-study/hello/mvc 才可以访问

不懂jetty,希望知道的人可以告诉我这是不是tomcat和jetty的差别。


写回答 关注

3回答

  • 单良
    2016-04-05 16:49:46

    非常赞!

  • 键盘兔
    2016-03-31 10:49:57

    问题一 项目jsp会报错 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    解决办法:web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Apache tomcat  7.0 -》finish

    问题二 有两个包需要加,不然会报错。教程里没有说。

    failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

    解决:

    <!-- JstlView必须的两个jar -->

    <dependency>

       <groupId>jstl</groupId>

       <artifactId>jstl</artifactId>

       <version>1.2</version>

    </dependency>

    <dependency>

       <groupId>taglibs</groupId>

       <artifactId>standard</artifactId>

       <version>1.1.2</version>

    </dependency>

    问题三 访问路径 在tomcat里必须要有项目名称 不然会404(教程里是http://localhost:8080/hello/mvc)

    应该是http://localhost:8080/spring-mvc-study/hello/mvc 才可以访问

    不懂jetty,希望知道的人可以告诉我这是不是tomcat和jetty的差别。


    qq_不囧_...

    终于找到答案了

    2018-04-23 15:44:34

    共 2 条回复 >

  • 路漫漫其修远兮xxx
    2016-03-30 20:56:25

    证明服务器端没有该文件

    键盘兔

    我按照教程一步一步来的。教程请求路径就没有项目根目录的名称,我不带这个项目名就是404 带上才能访问到服务器

    2016-03-31 10:20:12

    共 1 条回复 >

Spring MVC起步

Java中Spring MVC框架入门教程,快来看最易用的MVC框架

195980 学习 · 572 问题

查看课程

相似问题