As I'm learning Wicket, it strikes me as redundant that your component
hierarchy must essentially be expressed twice: once in the Java code, then
again in your HTML file.  

Why doesn't the Java code instead just define an unstructured "pool" of
components, and then rely on the structure indicated by the HTML file to
then dynamically assemble them appropriately, instead of making you the
programmer call all these add(Component) methods in the right order?  As it
is the Java structure always has to match the HTML structure anyway or
you'll get a runtime exception, so why not just rely solely on the HTML
hierarchy and let the Java components be unstructured until runtime?

The main impediment I can think of is that the structured Java code lets you
"scope" your elements so that two elements on the same page could have the
same wicket id provided that they're nested in different places.  But I'd
say the simplicity gained by defining the nesting just once in HTML is worth
the restriction that each element must have a unique wicket id within each
backing Java class.  Different components with different Java backing
classes could still have clashing ids, as long as each component is
internally consistent it should be fine.  You could even further break it
down by component type if desired, so that an anchor link and a span link
could have the same id because they're different types.

As I mentioned, I'm quite new to Wicket, so perhaps I'm missing something
fundamental here.  But this is has bothered me from day one (which granted
was not too many days ago...).  Thoughts?
-- 
View this message in context: 
http://www.nabble.com/hierarchical-redundancy-in-markup-tf4355099.html#a12409985
Sent from the Wicket - Dev mailing list archive at Nabble.com.

Reply via email to