Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

prefix attribute in the taglib directive (JSP 2.0, Servlet 2.4)

 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the correct syntax for JSP 2.0 ?

<%@ taglib uri="http://www.jspcentral.com/tags" prefix="public" %>
or
<%@ taglib prefix="public" uri="http://www.jspcentral.com/tags" %>

I am a bit confused here.
The specs http://java.sun.com/products/jsp/syntax/2.0/syntaxref2012.html#1003416
show that the attribute "prefix" comes after the "uri" tag.

But when I do that, I get an error and I have to put the attribute "prefix" in first position.
I already saw a thread about that topic but the specs on the Sun site still confuse me.

Please help me to clarify this. Thanks!
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just like for other directives, in taglib directive the order of attribute does not matter.
Can you confirm if you are using the latest version of the servlet-api.jar - which version of tomcat are you using?. What is your web.xml like? (Paste it over here)

Regards,
Shivani
[ September 04, 2006: Message edited by: Shivani Chandna ]
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply. I am using Tomcat 5.5.17, which includes servlet-api.jar version 2.4.
For information, Apache Tomcat version 5.5 implements the Servlet 2.4 and JavaServer Pages 2.0.

Here is my pretty basic web.xml :


Are you sure that the order does not matter ?
[ September 04, 2006: Message edited by: Max Fernandes ]
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Max,
I rechecked - ran a small code snippet and confirm that order does not matter.
I think the problem may be elsewhere.... Had the order mattered they would have specified it as a rule for directives in general.

Try using the jstl core library functions (eg: forEach) and see if this problem is happening for them as well? (Or is it just for your custom tags).

Regards,
Shivani
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Max, can you send us the error message ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic