File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Problem with jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with jstl" Watch "Problem with jstl" New topic
Author

Problem with jstl

Sanjay Izardar
Greenhorn

Joined: Apr 18, 2011
Posts: 19
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

Joined: Jan 10, 2002
Posts: 60997
    
  65

Wrong URI for the JSTL taglib.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sanjay Izardar
Greenhorn

Joined: Apr 18, 2011
Posts: 19
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

Joined: Jan 10, 2002
Posts: 60997
    
  65

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

Joined: Mar 24, 2008
Posts: 3825

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.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

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

Joined: Mar 24, 2008
Posts: 3825

...That way lies headaches and problems

Bear, Are you talking about any concurrency issues by this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60997
    
  65

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

Joined: Mar 24, 2008
Posts: 3825

Modified the How To section to reflect the same here.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem with jstl