Forums Register Login

Error coming while using c:out tag in JSTL

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Which version of JSTL are you using ?
You are probably using an older one which does not accept expressions.
+Pie Number of slices to send: Send
i am using jstl 1.0, is expression not supported by this version.
+Pie Number of slices to send: Send
How did you declare the taglib in your jsp file ?

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
If that is the URI you used, then you are using JSTL 1.1. What JSP container are you using?
+Pie Number of slices to send: Send
Try changing to:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

(rather then http://java.sun.com/jstl/core)
+Pie Number of slices to send: Send
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 c:out tag, but 1.0 did not support expressions.

So changing the taglib declaration to use the JSTL 1.1 URL fixed this.
+Pie Number of slices to send: Send
This is all well covered in the JSP FAQ.
Skool. Stay in. Smartness. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2641 times.
Similar Threads
fmt:formatDate problem
How to Set HashMap in request attribute using JSTL Tag
Confirmation required
dequoting jstl/el results
JSTL out with JSP expression
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:09:17.