I'm a beginner myself, so I could be way off, but I wonder if this is
the same misunderstanding I had with component bindings in tapestry 4.0
--
If a page specification has something like this:
<component id="x" type="MyComponent">
<binding name="theParameter" value="ognl:someData"/>
</component>
And the MyComponent.jwc file has something like this:
<parameter name="theParameter" required="yes" />
And the MyComponent.java file has something like this:
Private TheParameterType theParameter;
public void setTheParameter(TheParameterType value) {
theParameter = value; }
public TheParameterType getTheParameter() { return theParameter;
}
I expected that the page would call
"MyComponent.setTheParameter(getSomeData())" once during rewind and once
again during render.
But it turns out it doesn't work that way -- nothing happens unless the
component calls its own getTheParameter(), at which point the binding
kicks in. It makes sense actually, because I guess Tapestry can save
memory that way by not actually storing anything in the component.
I think it's an easy mistake to make if (1) the parameter is something
you're only using internally, (2) the parameter's setter is not
abstract, and (3) you access the parameter via the member variable, and
never call the getter.
Hope that helps!
-----Original Message-----
From: Kostya [mailto:[EMAIL PROTECTED]
Sent: Friday, November 11, 2005 4:04 AM
To: [email protected]
Subject: Howto perform operations in Component with updated bindings?
I'm a bit confused with how Tapestry works with bindings...
Issue description using example: I want to create an 'Edit User Groups'
component. Very simple.
Workflow like this:
- from any page I pass to this component userID;
- component (using userID) gets GroupDescriptor beans (not Group
business objects) and displays all groups multiple select with groups
user belongs to selected (each select option bound to corresponding
GroupDescriptor bean);
So, nothing hard. On a page I want to be able to put this component
wherever I want, press page's Submit button and in onSubmit listener get
from the the component above selected groups (NOT GroupDescriptors) I.e.
in component I have to get selected GroupDescriptors, convert them to
Group business objects (BO) and put these Group BO to some components
property which is bound to page's property .
If look on this generally then I want to perform some operation in
component AFTER form was submitted using NEW (updated) data.
It looks I could not do that! Form listener method triggered during
rewind. This is OK. However are there ANY methods in component which
called during rewind and where bound properties already updated? It
looks like there are NOT. I don't understand why.
Or maybe I have some general design problem? From my point of view my
desire having such functionality quite natural and I wonder why Tapestry
does not supports this...
Sorry for a long post - just tried to be more descriptive.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]