jstl那几个包到底分别用来干什么的?为什么项目中引入了还出错?

jstl那几个包到底分别用来干什么的?为什么项目中引入了还出错?

taglibs-standard-compat-1.2.5.jar

taglibs-standard-impl-1.2.5.jar

taglibs-standard-spec-1.2.5.jar 


Exception

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTag
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.servlet.ProductServlet.service(ProductServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.filter.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:19)

Root Cause

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTag
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2352)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:833)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1238)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1470)
org.apache.jasper.compiler.Parser.parse(Parser.java:144)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:383)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.servlet.ProductServlet.service(ProductServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.filter.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:19)

Root Cause

java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.LoopTag
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
java.base/java.lang.ClassLoader.defineClass1(Native Method)
java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1009)
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2352)
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:833)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1238)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1470)
org.apache.jasper.compiler.Parser.parse(Parser.java:144)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:383)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.servlet.ProductServlet.service(ProductServlet.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
com.yzb.cart.filter.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:19)


正在回答

登陆购买课程后可参与讨论,去登陆

1回答

这些包是jsp的标签库,用了这些包,就可以使用jstl和El表达式了,你的报错原因如下图,即找不到编译之后的文件了,建议你检查一下是否将相关的jar包添加到build Path中,祝学习愉快~

http://img1.sycdn.imooc.com//climg/5bcd3cb00001c6b607920128.jpg

  • 渐丶忘 提问者 #1
    我加到build Path里面了,昨天找了一下资料 ,顺便把源码下下来看了一下README,里面写到 To use this distribution with your own web applications, add the following JAR files to the '/WEB-INF/lib' directory of your application: - taglibs-standard-spec-1.2.5.jar - taglibs-standard-impl-1.2.5.jar - taglibs-standard-jstlel-1.2.5.jar - xalan-2.7.1.jar - serializer-2.7.1.jar If you do not use JSTL 1.0 tags then the "taglibs-standard-jstlel" JAR may be omitted. If you do not use the XML library, then the Apache Xalan dependencies may also be omitted. If you build you application with Maven, add the following dependencies to your pom.xml file: <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-spec</artifactId> <version>1.2.5</version> </dependency> <dependency> <groupId>org.apache.taglibs</groupId> <artifactId>taglibs-standard-impl</artifactId> <version>1.2.5</version> </dependency> 故应该需要的是两个包,spec和impl。。
    2018-10-22 11:19:45
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
从网页搭建入门Java Web2018版
  • 参与学习           人
  • 提交作业       1088    份
  • 解答问题       10205    个

如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师