Hello
once in the render method it's too late to change the properties.
Your component could implement org.apache.tapestry.event.PageRenderListener with method

pageBeginRender(PageEvent event) {
   if ( !event.getRequestCycle().isRewinding() ) {
      initStateCode();
   }
}

the page should automatically register the listener and execute the code, right before rendering. But I would rather suggest initializing the property through the jwc specification "initial-value" parameter or when the component class is instantiated, in the finishLoad() method for example. In this way, the property will show the initial value if not changed externally with the setter method, and you do initialize it only once.

Hope it helps.
See ya.

Hello,

First off, I'm using Tapesty 3, not 4.

I have a page, that has a custom component I created on it.
That custom component has a web template, and a number of other components
embedded in it.

I need to programatically set one of the parameters in one of the components
embedded in the custom component.

I had NO PROBLEM doing this, when the "AddressElements" (see code below)
component was part of the page spec, but now that I've added the component
to my custom component, I get this error :

"Page recorder for page InvestorCreateListing is locked after a commit(),
but received a change to property stateCode of component
InvestorCreateListing/EditListing.AddressElements."

Here's the code in my custom component :

/**
* @see org.apache.tapestry.BaseComponent#renderComponent(
org.apache.tapestry.IMarkupWriter,
* org.apache.tapestry.IRequestCycle)
*/
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
if (!cycle.isRewinding())
{
initStateCode();
}
super.renderComponent(writer, cycle);
}

/**
*
*/
private void initStateCode()
{
AddressElements addressElements = (AddressElements)
getComponent("AddressElements");
if (addressElements.getStateCode() == null)
{
addressElements.setStateCode("TX");
}
}


I'm trying to give the "stateCode" an initial value if it does not already
have one.

What am I doing wrong ?

Thanks in advance,
TappApp


--
Ivano Pagano

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to