Reputation: 685
In wicket 1.5, ChildFirstHeaderRenderStrategy
and ParentFirstHeaderRenderStrategy
are being used.
Is there anyone who can explain these render strategy in details, and give an example of how to use them when coding?
I don't know where to add these render strategies in my code.
Upvotes: 0
Views: 864
Reputation: 41137
In wicket 1.5, ChildFirstHeaderRenderStrategy and ParentFirstHeaderRenderStrategy are being used.
Is there anyone who can explain these render strategy in details, and give an example of how to use them when coding?
I haven't used them, but I can explain a bit anyway. They arose from the bug WICKET-2693, where it is noted that in Wicket 1.4, the rendering of headers was "backward", I.e., child components contributing to the header had their portions added after the parent components, making it difficult for the page to override things from contained components. This is the behavior given by ParentFirstHeaderRenderStrategy
. ChildFirstHeaderRenderStrategy
is the reverse, making contributions from inner components appear before their parents' contributions and is the default in Wicket 1.5. See the above bug report for more detail, and for some interesting debates between the wicket development team.
I don't know where to add these render strategies in my code.
You actually can't do it in code. They intentionally made it difficult to change, and made it apply to the entire application. It's driven by a system property.
You can make it switch to parent first by specifying the property in your server startup command:
-DWicket_HeaderRenderStrategy=org.apache.wicket.markup.renderStrategy.ParentFirstHeaderRenderStrategy
There are also issues WICKET-4235 and WICKET-4000 involving this not behaving properly with contributions from <header>
sections in the html fragments.
Upvotes: 3