File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes When can I use custom tag prefixes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "When can I use custom tag prefixes" Watch "When can I use custom tag prefixes" New topic
Author

When can I use custom tag prefixes

Carmen Brianick
Ranch Hand

Joined: Feb 23, 2006
Posts: 67
Hi, I just want to confirm 2 things on tag prefixes:

1. If I created my own tld and tag, I can do:
<%@ taglib prefix="mineOwnPrefix" uri="randomLocation"%>
<mineOwnPrefix:setMyText user="${userName}"/>

2. If I use the tld's provided by JSTL: Then I cannot use my own custom prefix like:
<%@ taglib prefix="mineOwnPrefix" uri="http://java.sun.com/jsp/jstl/core"%>
<mineOwnPrefix:forEach> ...

Am I right? I just got confused with when I can use my prefix and when I cannot.

Thanks so much,
Carmen
Satish Ramasamy
Greenhorn

Joined: Feb 13, 2006
Posts: 15
You can always use your own custom prefixes. There is no restriction on that.


Thanks,<br />Satish<br /> <br />SCJP 1.4 - 98%
Frederic Esnault
Ranch Hand

Joined: Feb 13, 2006
Posts: 284
Yes you can use the core library with another prefix than c. This is just a "convention". You can set the JSTL core library to whichPrefixShouldI then call tags with :

<whichPrefixShouldI:choose>
...

Sorry bad joke.

But the prefix is actually whatever you want.


SCJP 5 - SCWCD 1.4 - SCBCD 1.3 - Certification study documents/resources: http://esnault.frederic.free.fr/certification
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Not following the conventions will make your coworkers very unhappy.


A good workman is known by his tools.
Vishwas Hegde
Ranch Hand

Joined: Oct 02, 2003
Posts: 212

Not following the conventions will make your coworkers very unhappy.


Which might affect your appraisal also
Carmen Brianick
Ranch Hand

Joined: Feb 23, 2006
Posts: 67
Hi Frederic, thanks for your reply. However, in the Chapter 9 Mock Exam for HFSJ book, wasn't there a question where only the choice with <c:set > was the answer and no other choice. I have to get the exact question and I'll post a question with that. Do you know which question I'm referring to?

BTW, thanks so much for your study guides, Many thanks!!!
Carmen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When can I use custom tag prefixes