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 What is a Custom Tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "What is a Custom Tag?" Watch "What is a Custom Tag?" New topic
Author

What is a Custom Tag?

Dee Brown
Ranch Hand

Joined: Jun 14, 2008
Posts: 94
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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.


[My Blog]
All roads lead to JavaRanch
Dee Brown
Ranch Hand

Joined: Jun 14, 2008
Posts: 94
"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

Joined: Jan 10, 2002
Posts: 60050
    
  65

I'm sure Christophe meant the JSP Specification.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Jun 06, 2008
Posts: 139
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.


SCJP 1.4 (81%)<br />SCWCD 5 (95%)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

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

Joined: Jun 06, 2008
Posts: 139
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

Joined: Jan 10, 2002
Posts: 60050
    
  65

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

Joined: Jun 14, 2008
Posts: 94
Correction, "now" we all know what we mean. Thanks.
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
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).


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is a Custom Tag?
 
Similar Threads
Beta Links
Doubt in the HFSJ 9 chapter
custom actions vs custom tags
differnce between jstl and struts
Trouble with the term "Standard Action"