• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error coming while using c:out tag in JSTL

 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JSTL and include the code as follows -:

c ut value="${1 + 2}" /><br>

when i try to run the above code then it gives the following error -:

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

please tell me that whats the mistale and how can i rectify this.

Thanks
regards
Gaurav
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of JSTL are you using ?
You are probably using an older one which does not accept expressions.
 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using jstl 1.0, is expression not supported by this version.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you declare the taglib in your jsp file ?

 
Gaurav Chhabras
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i have declared in the same way, when i write simply

<c ut value="JAI SHRI RAM"/>
then it is working correctly, but when i write

<c ut value="${1+2}"/>

then it is giving error.

Thanks
Regards
Gaurav
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that is the URI you used, then you are using JSTL 1.1. What JSP container are you using?
 
Radek Gluch
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing to:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

(rather then http://java.sun.com/jstl/core)
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, I just came across this problem, and although this is an old post now, I felt compelled to clarify the reasons why this was happening.

I was using the JSTL 1.1 standard.jar on tomcat 5.5 (Servlet 2.4), which means all I needed to do to install this was place the standard.jar into WEB-INF/lib of the web application, and then define the taglib reference on the JSP page.

for JSTL 1.1 the URL that should be used is http://java.sun.com/jsp/jstl/core
so this looks like :


where as the JSTL 1.0 URL was
http://java.sun.com/jstl/core
so this would be


As it turns out, the JSTL 1.1 version of standard.jar seems to have the 1.0 compatibility in it as well,
so in my JSP page, I had cut-pasted the URL for 1.0, which works enough to find the cut tag, but 1.0 did not support expressions.

So changing the taglib declaration to use the JSTL 1.1 URL fixed this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is all well covered in the JSP FAQ.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!