On Thu, Nov 4, 2010 at 5:13 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Can you see the matrix?
>
> ;)
>
> If you have:
>
> <html>
>  <form wicket:id="form">
>     <input wicket:id="input" .../>
>  </form>
> </html>
>
> public class MyPage extends WebPage {
>    public MyPage () {
>       add(new Form("form"));
>       add(new TextField("input", model)); // Wicket could
> automatically handle parse hierarchy from markup
>    }
> }
>
> **
> Martin
>

Can you see how this would fail?

<html>
  <form wicket:id="form1">
    <input wicket:id="input" .../>
 </form>
  <form wicket:id="form2">
    <input wicket:id="input" .../>
 </form>
</html>

When wicket looks up "input", it must look it up on the appropriate parent
component.  You can't have two things in your page (or panel) that have the
same ID - Wicket couldn't possibly know how to differentiate which component
you mean when it parses the markup and finds the tag with ID "input".

What about repeaters?

What about if form1 was in BasePage.html and form2 was in HomePage.html
(which extends BasePage.html) - how do we know which input component to
get?  The one you called add on in BasePage.java, or the one in
HomePage.java?  Oh, we can't differentiate which class you called add from
within.  Oh, and you could have meant for the one added in HomePage.java to
replace the one added in BasePage.java.

How do you propose we do all that?

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Reply via email to