Peter,
I have getter and setter methods in my Phone.java and in my Parent file
NestedPhoneTest.java
here: is what i have
TestNestedPhone.page:
<component id="Phone" type="Phone">
<binding name="phone1" value="ognl:components.form.phone.phone1"/>
<binding name="phone2" value="ognl:components.form.phone.phone1"/>
<binding name="phone3" value="ognl:components.form.phone.phone1"/>
</component>
Phone.jwc:
<component id="phone1" type="TextField">
<binding name="value" value="phone1"/>
<binding name="validators"
value="validators:required[%invalid-area-code],pattern=\d{3}[%invalid-area-code]"/>
</component>
<component id="phone2" type="TextField">
<binding name="value" value="phone2"/>
<binding name="validators"
value="validators:required[%invalid-phone-num],pattern=\d{3}[%invalid-phone-num]"/>
</component>
<component id="phone3" type="TextField">
<binding name="value" value="phone3"/>
<binding name="validators"
value="validators:required[%invalid-phone-num],pattern=\d{4}[%invalid-phone-num]"/>
</component>
<property name="phone1"/>
<property name="phone2"/>
<property name="phone3"/>
Phone.html
<input jwcid="phone1" name="phone1" tabindex="80" size="3" maxlength="3"
displayName="Day Phone"/> -
<input jwcid="phone2" name="dayphone2" type="text" id="dayphone2ID" tabindex
="90" size="3" maxlength="3" displayName="Day Phone" /> -
<input jwcid="phone3" name="dayphone3" type="text" id="dayphone3ID" tabindex
="95" size="4" maxlength="4" displayName="Day Phone" />
What i'm hoping is for in the submitAction in my NestedPhoneTest.java to be
able to read the values.
I have
public void formSubmit(IRequestCycle cycle) {
String phone1 = getPhone1();
String phone2 = getPhone2();
String phone3 = getPhone1();
System.out.println(phone1 + phone2 + phone3);
}
the values come out nullnullnull
In my log i get this warning:
10 Mar 2006 14:56:43,765 WARN ComponentTemplateLoader:428 - Template for
component TestNestedPhone does not reference embedded component: Phone.
Is it my ognl binding?
jm
On 3/10/06, Peter Svensson <[EMAIL PROTECTED]> wrote:
>
> I think you just give them different names/ids like you already do. And
> since you have named the values already, you need only add some abstrcat
> access methods in your class,like;
>
> public abstract String getPhone1();
> public void setPhone1(String s);
>
> And you're done :)
>
> I don't think that the "type" actually does anything, possibly not the id
> in the html either.
>
> Generally, I'd recommend you to either do all in html or just name the
> component in the jwcid="" tag and then do everything kraftwerk-style in
> the
> .page file.
>
> Cheers,
> PS
>
>
> On 3/10/06, John Menke <[EMAIL PROTECTED]> wrote:
> >
> > I want to write a "Phone" component that allows me to define 3 text
> input
> > boxes contained inside it:
> >
> > My question is: How can can i bind/retrieve the values in my containing
> > page and how do I avoid name conflicts if i have more than 1 Phone
> > component
> > on the containing page?
> >
> > Phone.html
> >
> > <html>
> >
> > <body jwcid="$content$">
> >
> > <input jwcid="phone1" name="phone1" tabindex="80" size="3" maxlength="3"
> > displayName="Day Phone"/> -
> >
> > <input jwcid="phone2" name="dayphone2" type="text" id="dayphone2ID"
> > tabindex
> > ="90" size="3" maxlength="3" displayName="Day Phone" /> -
> >
> > <input jwcid="phone3" name="dayphone3" type="text" id="dayphone3ID"
> > tabindex
> > ="95" size="4" maxlength="4" displayName="Day Phone" />
> >
> > </body>
> >
> > </html>
> >
> > Phone.jwc
> >
> >
> > <component-specification allow-body="no">
> >
> > <component id="phone1" type="TextField">
> > <binding name="value" value="phone1"/>
> > </component>
> > <component id="phone2" type="TextField">
> > <binding name="value" value="phone2"/>
> > </component>
> > <component id="phone3" type="TextField">
> > <binding name="value" value="phone3"/>
> > </component>
> > </component-specification>
> >
> > **
> >
> > -jm
> >
> >
>
>