aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Order of dynamic and static attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Order of dynamic and static attribute" Watch "Order of dynamic and static attribute" New topic
Author

Order of dynamic and static attribute

Nitin Kumar
Greenhorn

Joined: Apr 18, 2005
Posts: 29
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

Joined: Nov 04, 2009
Posts: 2066

I think, the order isn't important. Because, we specify the name of the attributes. Please confirm!

Thanks!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1734
    
  25

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

Joined: Nov 04, 2009
Posts: 2066

Thanks Frits for confirming!
Nitin Kumar
Greenhorn

Joined: Apr 18, 2005
Posts: 29
Hi Frits,

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

Regards,
Nitin
Malika Ben Aziz
Greenhorn

Joined: Oct 26, 2009
Posts: 23
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

Joined: Apr 18, 2005
Posts: 29
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
Bartender

Joined: Apr 07, 2010
Posts: 1734
    
  25

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Order of dynamic and static attribute