There are some approaches to that problem, one approach would be to use
the parameter binding for that:
The component gets a paraemter from its container, and is responsible to
update the parameter.
Say you have a property on your page/container component:
public Data getData() {...}
public void setData( Data data ) { // now perform the save }
you pass "data" as a paraemter binding to your component which includes
the form, and on your submit listener, after verifying everything is
fine, you call setData:
@Parameter public abstract Data getData();
public abstract void setData( Data data );
public void doSubmit() {
// validata...
// check that everything is ok...
if (getDelegate().getHasErrors() )
return;
setData( getData() );
}
Another approach would be to use an IActionListener as paramter and
invoke it - this is the approach I take usually.
Hope that helps,
Cheers,
Ron
Skorpien126 wrote:
Hi...
I´ve another Post, describing the same problem. In my eyes it is one the
things which should be solved more than one times. So I will give a whole
describtion about what I want.
OK... i have ca 30 tables each one, holding information about 1 product.
Lets say one table holds information of chairs, the other of tables and so
one. Each Table has a dynmamic number of Columns. Maybe an id, describing
text, a date.. . For each Type I´ve build a subcomponent ... DateComponent,
StringComponent and so on. The Subcomponents include the "value"
(String,date ...) the validation and maybe some further functionality.
Ok... when openening a Page I get an Id with which I create a
Containercomponent "RequestContainer"(PERSISTBEAN) ... this Container
includes a Collection of "Subcomponents" correspondening to the coloums of
the depending table and also some further, unimportant informations...
Ok... so far so good. It´s not problem to visualize the information. But I
want to update the whole Object at once. So I´ve make a form in the
Containercomponent and in the Form-Tag I iterate over the Column-Values. The
Form invokes a SaveMethod. In which I want to write back the values of the
validated, values of the subcomponents. My Question... How Can I get the
values of the dynamic subcomponents???? (image that it+s not possible to
bind a parameter to a dynamicList-Item) How can I check that each value is
"correct/validated"???
If more code is needed... just ask.
Thx u... and have a nice WE.
Here Some Example Code:
ContainerComponent.html
<form jwcid="[EMAIL PROTECTED]" success="listener:saveAll">
<span jwcid="@Foreach" source="ognl:item.getList()"
value="ognl:ListItem" index="ognl:ListIndex">
<span jwcid="@If" condition="ognl:ListItem instanceof DisplayString">
<span jwcid="@DisplayString" item="ognl:ListItem" editable="true"/>
</span>
<span jwcid="@If" condition="ognl:ListItem instanceof DisplayDate">
<span jwcid="@DisplayDate" item="ognl:ListItem" editable="true"/>
</span>
...
</span>
<form jwcid="@bf:BeanForm"
DisplayString.html
<span jwcid="@If" condition="ognl:editable">
<input type="text" jwcid="ColoumNameComponent"/><br/>
<br/>
<textarea jwcid="contentComponent" cols="70" rows="10">
Der Inhalt halt...
</textarea>
<p></p>
</span>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]