开发者

When using JSTL in JSP, getting an exception

Getting following exception when I have included:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Exception:

java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator

What I have done:

开发者_如何学Python
  1. Included JSTL jar file WEB-INF/lib folder
  2. Included Classpath in Run Configuration (using Eclipse)
  3. Included in Build path too.


1: Included JSTL jar file WEB-INF/lib folder

Fine. That ought to be sufficient.

2: Included Classpath in Run Configuration (using Eclipse)
3: Included in Build path too.

Don't do. Eclipse does that automatically on 1. You need to undo all manual changes, they might make things worse.

I have included JSTL.jar(Version 1.2) and JSTL Standard.jar

Get rid of standard.jar. JSTL 1.2 consists of only one JAR file. The standard.jar might want to locate classes which doesn't exist in JSTL 1.2 anymore, resulting in this kind of abstract/dependency errors.

See also:

  • Our JSTL wiki page


You need to include both jstl.jar and standard.jar in your WEB-INF/lib folder.


Solution in eclipse:

Right click on

nameYourProject->java build path -> libraries -> add external jars 

Go

 C:\Apachetomcat7\webapps\examples\WEB-INF\lib

Select all( jstl and standart jar ), click open

after import jstl and standart jar in project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜