Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is a Custom Tag?

 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HSF book has done little more than confuse this subject since answer 6D on page 497 states "<c ut value="x" /> is a custom tag. I have submitted errata for this, but I need to know what the correct answer is on the REAL exam. I ask this because according the Sun, "A custom tag is a user-defined JSP language element." This can be found at the following link:

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags2.html#67760

Again, all I am looking for is what is correct for the REAL exam.

The confusion mentioned above was documented in submitted errata, which I am providing below. I will also add that although the hsf book is good, on occasion it lacks clarity (errata submitted). In addition to this issue, another example is the failure to explicitly reinforce (as opposed to package foo the fact that jsp accessed beans/classes must be placed in a package before they are visible to the jsp.

Here is the custom tag errata:

Answer 6D suggests <c ut value="x" /> is an example of custom tag usage. The paragraphs that follow suggests this is false. I also believe the book results in confusion in understanding what are standard and custom tags:

On page 2 of the spec (jstl-1_2-mrel2-spec.pdf), at the end of section 1.1 the spec states, "The other key aspect of JSTL is that it provides standard actions and standard EL functions...". The spec then goes on to list the 5 associated libraries. Furthermore, on page 31 in Section 5.2 is one of the few instances the spec refers to "custom" as a subject. Here is speaks of a custom action of the form "<acme:fullMoon>", which is clearly not part of jstl. Other reference suggest "custom" implies "programmer supplied/constructed".

Based on this information I am lead to believe the JSTL supplied tags are standard tags, and programmer supplied tags, which are tags not defined by the jstl spec, are custom tags. This is in fact the subject of Chapter 10, which states in the opening page, "Sometimes JSTL and standard actions aren't enough. When you need something custom...". However, the opening page of Chapter 9, which is titled, "Using JSTL", states, "Custom tags are powerful".

Based on the spec I believe there are JSP standard actions/tags, and JSTL standard action/tags. An action/tag that is not a member of the above groups is therefore considered a custom action/tag.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL is just a tag library, made of custom tags, with its own TLDs. Standard actions are listed in the Servlets Specification. Other things are custom. You could make your own tag library too, name it the "Dee Brown Standard Library". Everybody is using it, it finally has its own spec, great. But it still is a custom tag library.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Standard actions are listed in the Servlets Specification"

A search on "action" in v2.5 of the servlet spec failed to locate any associated reference as it relates to the subject of this post. However, page 1-32 (JSP.1.3.10.3 Standard Action Attributes) in v2.1 of the JSP spec lists actions of the form "jsp:useBean".

I guess the question should have been, "What are standard tags?". Are standard tags associated with standard actions (i.e. <jsp:forward>, <jsp:include>, <jsp:useBean>, <jsp:setProperty>, <jsp:getProperty>...). If this is correct, why are they considered standard (because they came before jstl?). If this is not correct, can anyone point me to a spec where the subject of "standard tags" discussed? Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64699
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure Christophe meant the JSP Specification.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, as Bear says, I meant the JSP specification. Sorry for the confusion. By the way, you should use the Servlets 2.4 and JSP2.0 specs for this exam. Yes it's called SCWCD5, but the specs used are still those used for SCWCD1.4.
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that the terminology is poorly chosen. They should have called standard actions standard tags. Or custom tags custom actions. And the JSTL SFTL: Sun's Free Tag Library.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64699
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jan Sterk:
I agree that the terminology is poorly chosen. They should have called standard actions standard tags. Or custom tags custom actions. And the JSTL SFTL: Sun's Free Tag Library.
I disagree -- I think that would be more confusing terminology.

I think the current terminology is fine: standard actions are those defined in the JSP Specification; anything else is a custom action.
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
..anything else is a custom action.


Now I'm confused. I thought they are called custom tags!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64699
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As of JSP 2.0, they are officially called "actions" (don't ask me why -- that was a poor choice, in my opinion). But most everyone still uses "tags" and we all know what we mean.
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correction, "now" we all know what we mean. Thanks.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're still confused, you might want to check chapters 13-17 of my book I deliberately spend ages working through standard actions, JSTL, custom tags, tag files and tag deployment as it is undoubtedly one of the trickest JSP areas on the exam - there's a lot of detail in there and some relatively tough concepts too. Feel free to check the TOC at the publisher's website (see signature).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic