• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSTL : not working with JSP 2.0

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I was trying to run JSP 2.0 tag sample. here are the tag and jsp files.

wrapper.tag
----------
<%@ tag body-content="scriptless" %>
<%@ attribute name="a" required="true" %>
<%@ attribute name="b" required="true" %>
<%@ attribute name="c" required="true" %>
<%@ attribute name="d" required="false" %>
<p> Header
<p> Attributes - ${a}, ${b}, ${c}</p>
<table>
<tr>
<td>${a}</td>
<td>${b}</td>
</tr>
</table>
<p> Footer
---------- and my JSP is
main.jsp
------------
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<tags:wrapper a="1" b="2" c="3" >
<p> Wrapped Content
</p>
</tags:wrapper>

----
web.xml contents
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_3.xsd"
version="2.3">


when I ran main.jsp I am getting
Attributes - ${a}, ${b}, ${c}
instead of Attributes - 1,2,3

the values are not being evaluated. Any suggestion/help would be appreciated. I used version 2.4 also. but i am getting this error
"According to TLD or attribute directive in tag file, attribute value does not accept any expressions" when using 2.4.

Any idea??
Thanks
-Chandra K
 
Sheriff
Posts: 67746
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
I'm confused. What does this have to do with the JSTL?

And, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Bear Bibeault
Sheriff
Posts: 67746
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
Your issue is that your web app is incorrectly declared as a servlets 2.3 web app. See the JSP FAQ to see how to correctly declare your web app as Servlets 2.4 (which enables the EL).
 
chandra konduru
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys. it worked. There is a problem with web-app format. yes it has nothing to do with JSTL.my bad. anyway thanks once again for your advice.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You know that custom tags that write yourself are not the same thing as JSTL, right?
 
reply
    Bookmark Topic Watch Topic
  • New Topic