• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with jstl

 
Sanjay Izardar
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to jstl.
I put the jstl.jar and standard.jar files in webapps/myApp/WEB-INF/lib and webapps/ROOT/WEB-INF/lib
and then i run a simple jsp file

result3.java

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>JSTL Simple Conditional Execution Example</title>
</head>
<body bgcolor="#FFFFcc">
<h1>For Loop in JSTL</h1>
<c:forEach var="i" begin="1" end="20" step="1" varStatus ="status">
<cut value="${i}" />
</c:forEach>
</body>
</html>




and i am getting this exception
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /result3.jsp(9,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

org.apache.jasper.JasperException: /result3.jsp(9,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
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.Validator$ValidateVisitor.visit(Validator.java:730)
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.Validator.validate(Validator.java:1489)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.


what the heck is wrong. Did i place wrong the jar files? if yes, then where it should be placed?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wrong URI for the JSTL taglib.
 
Sanjay Izardar
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply Bear..
what should be the correct uri, and do i have to make any changes in web.xml?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do nothing in the web.xml. The correct URI can be found in the JSTL Specification which you must have a copy of if you are going to be using the JSTL.

See the JspFaq for links.
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check How to Setup JSTL for the details. And please use code tags while posting code in the forums (UseCodeTags).

Remove the jar files from webapps/ROOT/WEB-INF/lib, I don't think you need them there? If they are to be shared globally by the other applications in the container then keep them inside the shared library folder (<TomcatHOME>/lib for Tomcat 6.xx) of the container.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:Remove the jar files from webapps/ROOT/WEB-INF/lib, I don't think you need them there? If they are to be shared globally by the other applications in the container then keep them inside the shared library folder (<TomcatHOME>/lib for Tomcat 6.xx) of the container.

No. No. No. No. NO!

The JSTL jar files go into WEB-INF/lib.

Do not put them anywhere else. That way lies headaches and problems.
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...That way lies headaches and problems

Bear, Are you talking about any concurrency issues by this?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Endless classloader issues and the inability for each app to use differing versions. Best practice is to use WEB-INF/lib as intended.
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modified the How To section to reflect the same here.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic