Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Exception when using JSTL <c:out> with EL expressions

 
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

I am using an expression language within the value attribute of <c:out> but i get the following exception.The following is my <taglib> declaration in the JSP
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

the <c:out> that i used is
<c:out value="${musicMap.Ambient}" escapeXml="true"></c:out>.


I have put the .tld files inside a directory called 'tld' under WEB-INF.I have also added information about the taglib in web.xml.
The jstl.jar and standard.jar are inside the 'lib' directory in the WEB-INF.

Now i get the following exception.

org.apache.jasper.JasperException: /files/cout.jsp(20,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:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1174)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:821)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1736)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


I would be thankful if anybody can help me out on this.


Thanks,
Deepak.
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the future, please be sure to check the "disable similes" checkbox when posting code. I have adjusted your post for you.
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

That's the URI for the older JSTL 1.0 version. Surely not the one you intended to use?
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepaks Deshpande wrote:
I have put the .tld files inside a directory called 'tld' under WEB-INF.I have also added information about the taglib in web.xml.


Wrong and wrong. Remove the TLD files and remove any declarations in the web.xml. They are not necessary and are likely just to gum up the works.

Once you are using the correct URI for the JSTL, the container will automatically find the TLD files in the jar files without all that goop.
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have fixed the exception. I changed the <taglib> declaration in the JSP from
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> to

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>.Now the code works fine.


Thanks,
Deepak
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you bother to post here if you are going to ignore the responses?

That's not correct. You are still using the JSTL 1.0.

While it may appear to be working, you will come across other problems if you do not fix it correctly.

What version of JSTL are you intending to use? Unless you are still using JSP 1.2, you are using the wrong version of the JSTL!
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using eclipse and if i change the <taglib>'s uri declaration from <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> to this <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> I am getting an exception saying the usi cannot be resolved. I also tried removing the .tld files from WEB-INF directory but again got the same exception.
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, what version of JSP are you using?

You may have old versions of the jar files.
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded the jstl from apache site it is jakarta-taglib-1.1.2 and i am using jre 6 and javaee 5
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have the JSTL 1.1, then you need to be using the JSTL 1.1 URIs.

If eclipse (I hate IDEs) is complaining, find out why.
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic