Forums Register Login

When can I use custom tag prefixes

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
You can always use your own custom prefixes. There is no restriction on that.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Not following the conventions will make your coworkers very unhappy.
+Pie Number of slices to send: Send
 


Not following the conventions will make your coworkers very unhappy.



Which might affect your appraisal also
+Pie Number of slices to send: Send
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
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 625 times.
Similar Threads
JSTL EL language not resolving
standared tag uri : need clarification
How to Custom tags in jsp
uri element ,taglib element
Can we have 2 URIs for same TLD?
More...

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