aspose file tools
The moose likes JSP and the fly likes Error coming while using c:out tag in JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Error coming while using c:out tag in JSTL" Watch "Error coming while using c:out tag in JSTL" New topic
Author

Error coming while using c:out tag in JSTL

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
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

Joined: Nov 24, 2005
Posts: 14669
    
  11

Which version of JSTL are you using ?
You are probably using an older one which does not accept expressions.


[My Blog]
All roads lead to JavaRanch
Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
i am using jstl 1.0, is expression not supported by this version.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

How did you declare the taglib in your jsp file ?

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
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

Joined: Jan 10, 2002
Posts: 56162
    
  13

If that is the URI you used, then you are using JSTL 1.1. What JSP container are you using?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Radek Gluch
Greenhorn

Joined: Mar 24, 2006
Posts: 1
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

Joined: Jun 06, 2006
Posts: 161
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.


Error: Keyboard not attached. Press F1 to continue.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56162
    
  13

This is all well covered in the JSP FAQ.
 
I agree. Here's the link: jrebel
 
subject: Error coming while using c:out tag in JSTL
 
Similar Threads
dequoting jstl/el results
fmt:formatDate problem
How to Set HashMap in request attribute using JSTL Tag
JSTL out with JSP expression
Confirmation required