Oh - you are using tapestry 3.0...
try playing with the direction of your parameters, or better, understand
what they mean, which I never did. This will probably solve the problem...
In Tapestry 4.0 parameters just work, which is great...
Cheers,
Ron
ציטוט Matthew Wheaton:
This *seems* like it should be simple.
I have a component that takes a parameter "address", and some
property-specifications that need initial values based on some values with
the object represented by parameter "address".
However, when the methods specified in the initial-value parameter of the
property-specification is called, the Address they expect is null.
I can't seem to modify those property-specification items during any
component events, because either the Address is not yet set, or, when it is,
I get an exception saying the page is locked.
Isn't there somewhere, or some event, where, all parameters are set in the
component, and I can programmatically manupulate the component properties ?
I'm positive I'm passing in an address to the component, because other,
editable fields of the address are visible on the form.
Here's my address spec file :
Note, all the components that use the "address" param, like "addressLineOne"
work fine. It just seems the property-specs can't use the address yet ?
Below the address spec, is the methods that are called in the property spec,
and the values of the address is null
<component-specification allow-body="no"
allow-informal-parameters="no"
class="com.ughm.app.view.tapestry
.components.entities.address.AddressElements">
<description>
Elements for an address.
</description>
<parameter name="address"
required="yes"
direction="in"
type="com.ughm.entities.address.Address"/>
<property-specification name="stateCode"
type="java.lang.String"
persistent="yes"
initial-value="setInitialStateCode(address)"/>
<!-- says "address" is null, even though I'm passing it in properly -->
<property-specification name="zip"
type="java.lang.String"
persistent="yes"
initial-value="setInitialZip(address)"/>
<!-- says "address" is null, even though I'm passing it in properly -->
<component id="addressLineOne" type="ValidField">
<binding name="displayName" expression="getL10N('addressLineOne')"/>
<binding name="validator" expression="page.requiredStringValidator"/>
<binding name="value" expression="address.lineOne"/>
</component>
</component-specification>
Methods follow :
public String setInitialStateCode(Address address)
{
log.debug("initial state code address : " + address);
if (address != null)
{
if (getStateCode() == null)
{
State state = address.getState();
if (state != null)
{
return state.getCode();
}
}
}
return null;
}
public String setInitialZip(Address address)
{
log.debug("initial zip address : " + address);
if (address != null)
{
if (getZip() == null)
{
PostalCode postalCode = address.getPostalCode();
if (postalCode != null)
{
return postalCode.getCode();
}
}
}
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]