-
Problems encountered in using JSTL 1.2
-
JSP code
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" isELIgnored="true"%> <%-- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> --%> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>runoob</title> </head> <body> <% out.println("Hello Runoob!"); out.println("Hello Green hand!"); %> <!-- Test it jstl loop --> <c:forEach var="x" begin="1" end="5"> <c:out value="${x }"></c:out> </c:forEach> </body> </html>
- Download address of JSTL package (these two packages need to be imported)
——-Dividing line --
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/LoopTag error:
Put the corresponding jstl.jar into the tomcat/lib directory
java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/ForEachTag error:
Put the corresponding standard.jar in the tomcat/lib directory
standard.jar JSTL Download
——– dividing line --
If so, java.lang.noclassdeffounderror will still appear: javax / servlet / JSP / JSTL / core / looptag
This is because javax.servlet.jsp.jstl-1.2.X.jar does not contain javax.servlet.jsp.jstl.core
Go to the website portal to download jstl-1.2.jar and put it under lib / to solve Nice perfectly
- New error
HTTP Status 500 - java.lang.NoSuchMethodError: org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.validate(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; type Exception report message java.lang.NoSuchMethodError: org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.validate(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.validate(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NoSuchMethodError: org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.validate(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; org.apache.taglibs.standard.tlv.el.ValidationUtil.validateExpression(ValidationUtil.java:26) org.apache.taglibs.standard.tlv.el.JstlELCoreTLV.validateExpression(JstlELCoreTLV.java:26) org.apache.taglibs.standard.tlv.JstlCoreTLV$Handler.startElement(JstlCoreTLV.java:157) com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source) javax.xml.parsers.SAXParser.parse(Unknown Source) org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:165) org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:105) org.apache.jasper.compiler.TagLibraryInfoImpl.validate(TagLibraryInfoImpl.java:379) org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1890) org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1859) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217) org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.27 logs. Apache Tomcat/8.0.27
All problem solving tests successful
- eclipse creating web project Dynamic Web Project
- Version 2.5 or above (you can try it later)
- Copy two LIBS to the following path
- WebContent - WEB-INF - lib
- 1 ,jstl-1.2.jar
- 2,taglibs-standard-jstlel-1.2.5.jar
- Create a jsp test file under WebContent
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%> <!-- Here is what needs to be introduced jstl Of lib --> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>runoob</title> </head> <body> <% out.println("Hello Runoob!"); out.println("Hello Green hand!"); %> <!-- Test here jstl call forEach loop --> <c:forEach var="x" begin="1" end="5"> <c:out value="${x}"></c:out> </c:forEach> </body> </html>
- eclipse configures tomcat to run test results
-