This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes prefix attribute in the taglib directive (JSP 2.0, Servlet 2.4) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "prefix attribute in the taglib directive (JSP 2.0, Servlet 2.4)" Watch "prefix attribute in the taglib directive (JSP 2.0, Servlet 2.4)" New topic
Author

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

Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

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!


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCBCD 5
Visit my blog
Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
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 ]

/** Code speaks louder than words */
Celinio Fernandes
Ranch Hand

Joined: Jun 28, 2003
Posts: 547

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

Joined: Sep 18, 2004
Posts: 380
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

Max, can you send us the error message ?


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: prefix attribute in the taglib directive (JSP 2.0, Servlet 2.4)