Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Order of dynamic and static attribute

 
Nitin Kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to know if the order of static and dynamic attributes matters or not, when we implement DynamicAttributes interface?

I have tested this feature with this jsp and found that order doesn't matter.



In this JSP subject is a static attribute and size a dynamic one.The second call ( line 05) to myTags is not throwing any error and the JSP is accessed successfully. Is it specific to the container that I am using or a general rule that static and dynamic attribute can appear in any order.

I have gone through the specs also , but couldn't find anything related to the order. Did I miss something?

Thanks
Nitin
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, the order isn't important. Because, we specify the name of the attributes. Please confirm!

Thanks!
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2407
93
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitin,
I have gone through the specs also , but couldn't find anything related to the order. Did I miss something?

No, you didn't miss anything, there is no specific order defined.

Regards,
Frits
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits for confirming!
 
Nitin Kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,

Thanks for your reply. So it means we can put these attributes in any order.

Regards,
Nitin
 
Malika Ben Aziz
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure order is relevant?
Because on Hanumant Deshmukh Book, SCWCD EXAM STUDY KIT SECOND EDITION
chapter 17, question 3, page 467 I read this:

The <dynamic-attributes> element is set to true, so JSP statements
can incorporate variables beyond those mentioned in the TLD. If there are
static and dynamic values in a tag, the static values need to come first,


 
Nitin Kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure order is relevant?
Because on Hanumant Deshmukh Book, SCWCD EXAM STUDY KIT SECOND EDITION
chapter 17, question 3, page 467 I read this:


In fact, I tested above JSP, while going through one of the questions of same book ( Chapter 17, Question 3). I was not very convinced with the explanation given and hence tried to test it my self.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2407
93
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure order is relevant?
Because on Hanumant Deshmukh Book, SCWCD EXAM STUDY KIT SECOND EDITION
chapter 17, question 3, page 467 I read this:
The <dynamic-attributes> element is set to true, so JSP statements
can incorporate variables beyond those mentioned in the TLD. If there are
static and dynamic values in a tag, the static values need to come first,

I have checked the specs about it and I can't find anything confirming that part of the book you are mentioning.

Actually it says the following:
JSP.13.3 Dynamic Attributes
For each attribute specified in the tag invocation that does not have a corresponding
attribute element in the TLD for this tag, a call must be made to set-
DynamicAttribute(), passing in the namespace of the attribute (or null if the
attribute does not have a namespace or prefix), the name of the attribute without
the namespace prefix, and the final value of the attribute.

So for every attribute the container has to check whether it is an attribute explicitly defined (in the TLD) before considering it as a dynamic attribute. I don't see a reason why static attributes have to come first....

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic