Hi,
  Your first syntax should work - Check the  object that
CompoundPropertyModel wraps & have a look at this, as this works for
me...

-HTML-
<html>
    <body>
        <form wicket:id="form">
            <ul>
                <li><span wicket:id="name"></span></li>
                <li><span wicket:id="organization"></span></li>
                <li><span wicket:id="organization.name"></span></li>
                <li><input type=submit value="OK" /></li>
            </ul>
        </form>
        <hr>
        <span wicket:id="feedback" />
    </body>
</html>
----
-Java--
package wicket.quickstart;

import wicket.PageParameters;
import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Form;
import wicket.markup.html.panel.FeedbackPanel;
import wicket.model.CompoundPropertyModel;

public class FormDemo extends WebPage {
    public FormDemo(final PageParameters parameters) {
        add(new MyForm("form"));
        add(new FeedbackPanel("feedback"));
    }

    private static class MyForm extends Form {
        public MyForm(String name) {
            super(name,
                  new CompoundPropertyModel(
                          new Contact("PointyHairedBoss",
                                      new OrganizationInfo("BigCo"))));
            add(new Label("name"));
            add(new Label("organization"));
            add(new Label("organization.name"));
        }
        public void onSubmit() { info("Model = " + getModelObject()); }
    }

    private static class Contact {
        String name;
        OrganizationInfo organization;
        public Contact(String name, OrganizationInfo organization) {
            this.name = name;
            this.organization = organization;
        }
        public String getName() { return name; }
        public OrganizationInfo getOrganization() { return organization; }
        public String toString() {
            return "Contact{" + "name='" + name + "'" + ",
organization=" + organization + "}";
        }
    }

    private static class OrganizationInfo {
        String name;
        public OrganizationInfo(String name) { this.name = name; }
        public String getName() { return name; }
        public String toString() {
            return "OrganizationInfo{" + "name='" + name + "'" + "}";
        }
    }
}
----
/Gwyn




On 28/08/05, leo <[EMAIL PROTECTED]> wrote:
> I have an form for a 'Contact' class that looks like this :
> 
> <<Class>> Contact
>   name : String
>   organization :  OrganizationInfo
>   ...
> 
> <<Class>>OrganizationInfo
>   name : String
>   ...
> 
> My problem is to display the 'organization.name' field : I cant get
> wicket to translate any organization fields in the HTML view. I've
> tried 3 syntaxes to reference the field :
> 
>    <input type="text" wicket:id="organization.name" value=""
> style="width:120px" />
> 
>    <input type="text" wicket:id="organization:name" value=""
> style="width:120px" />
> 
> and finally wrapping the organization fields in an 'organization' span :
> <span wicket:id="organization">
>       <input type="text" wicket:id="name" value="" style="width:120px" />
> 
> 
> Stacktrace top ( third syntax )
> wicket.markup.MarkupException: Unable to find component with id
> 'organization' in [MarkupContainer [Component id = form, page =
> test.wicket.ContactForm, path = 2:form.CtcForm, isVisible = true,
> isVersioned = true]]
> [markup = file:/projects/w4j/web/WEB-INF/classes/w4j.view/ContactForm.html,
> index = 25, current = '<span wicket:id="organization">' (line 67,
> column 1)]
>     at wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:277)
>     at wicket.MarkupContainer.renderNext(MarkupContainer.java:1139)
>     at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:781)
>     at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:723)
>     at wicket.Component.renderComponent(Component.java:1805)
>     ....
> 
> thanks for your time,
> 
> Leo


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to