Hi all,
I am trying to execute a simple application using JSTL tags. But got stuck up due to the below mentioned error/exception
Please find the error description below:
exception
javax.servlet.ServletException: javax/el/ValueExpression
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.jstl.demo.JstlDemoServlet.doPost(JstlDemoServlet.java:18)
com.jstl.demo.JstlDemoServlet.doGet(JstlDemoServlet.java:23)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NoClassDefFoundError: javax/el/ValueExpression
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Unknown Source)
java.lang.Class.getDeclaredMethods(Unknown Source)
java.beans.Introspector$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)
java.beans.Introspector.getTargetMethodInfo(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
java.beans.Introspector.<init>(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
java.beans.Introspector.<init>(Unknown Source)
java.beans.Introspector.getBeanInfo(Unknown Source)
org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3678)
org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2100)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1579)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.jstl.demo.JstlDemoServlet.doPost(JstlDemoServlet.java:18)
com.jstl.demo.JstlDemoServlet.doGet(JstlDemoServlet.java:23)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
This is my
servlet:
package com.jstl.demo;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class JstlDemoServlet extends HttpServlet
{
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String[] movieList = {"Peaceflu Warrior","Apacolypto","Fearless","Perfume"};
request.setAttribute("movieList", movieList);
RequestDispatcher view = request.getRequestDispatcher("/MovieList.jsp");
view.forward(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doPost(request, response);
}
}
This is my
jsp:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<strong>Movie List : </strong>
<c:forEach var="movies" items="${movieList}">
${movies} |
</c:forEach>
</body>
</html>
Following are the 3 jar files include in the application:
1. standard.jar
2. jstl.jar
3. jstl-1.2.jar
This is my xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
JstlDemo</display-name>
<servlet>
<description>
</description>
<display-name>
JstlDemoServlet</display-name>
<servlet-name>JstlDemoServlet</servlet-name>
<servlet-class>
com.jstl.demo.JstlDemoServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>JstlDemoServlet</servlet-name>
<url-pattern>/JstlDemoServlet</url-pattern>
</servlet-mapping>
</web-app>
Awaiting your positive response !! Thanks in Advance