• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF and dynamic attributes

 
Henrik Krievs
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did I miss something or is dynamic_attributes just put in the mock-exam whitout prior notice ??

Rgds, Henrik
 
Colin Fletcher
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read chapter 10 twice (end to end) now and skimmed it a couple of times and haven't found anything related to dynamic attributes. Where's my wife ? she can always find the thing that is in front of my face...
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... there was at one time a page on dynamic attributes, but it somehow did NOT make it into the final book!

So, you didn't miss anything. Or rather, you *did* miss it--and it's not there.

This is definitely an error on our part--there should have been something in there. There is a small chance that you could have *one* (no more than one) question on the exam that involves dynamic attributes, but I can explain all that you need to know here:

If you create a tag handler and you do not know in advance the number or names of the attributes the tag might use, in other words--you want a tag that can have an arbitrary number of attributes--you must do these things:

1) The tag handler class must implement the DynamicAttributes interface
(javax.servlet.jsp.tagext.DynamicAttributes)

2) The TLD for the tag must specify the <dynamic-attributes> element, with a value of true
<dynamic-attributes>true</dynamic-attributes>

You do not need to know how to implement dynamic attributes in the tag handler, or anything else about invoking a tag that uses dynamic attributes.

Sorry about this!

So, don't feel bad if you missed that question on the mock exam

And now you know what's important for the real exam, with respect to dynamic attributes. As I said, it *is* possible that you could have a question about that, although we did not explicitly put this in the exam objectives.

cheers,
Kathy
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could this problem be solved by passing in an object, instead of atttributes?

For example, there is an object which has 5 attributes before, and the tag handler based on how many attributes are null or not null (if we dont need that attribute, just put it to null) so that the behaviour of the tag can totally depend on the input object?

Nick
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There have been a few cases (can't remember exactly what now, but "dynamic-attributes" was certainly one of them!) where, on going through the book, the questions ask something that I didn't recall from the chapters (some subtlety perhaps). Whilst I got some questions wrong because of it, I've actually found it useful, since it has prompted me to look at the specs concerned, based on the spec references (hooray for them! ) in the "hand-written" text alongside the answers.

Some of the questions seemed to test things that hadn't been covered until the next chapter (Using single quotes in EL was one example of this). Coming from a 1.3 background you'd probably know the stuff and not notice this, but since this is my first foray into the realms of Servlets & JSPs they had me stumped initially!
This could have been a gripe, but isn't since I found it helped me to learn the stuff better by getting me used to looking at the specs. Without the references by each question, I'd have been much less likely to "have got around to" looking them up! Now I can find my way around the specs reasonably well .

That said, a page on "dynamic-attributes" would have been handy!
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To me, reading the specs is quite painful.

Nick
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic