You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sockmonster <ol...@gmail.com> on 2011/03/25 19:31:25 UTC
form for nested entity
Hi, I have a question about forms. I want to create a form for an entity
class, however the entity class contains references to other entities. For
example:
class Item {
long id;
String name;
String desc;
Media media;
...
}
class Media {
String filename;
String type;
...
}
When I create a form for the Item entity it leaves out the Media reference
(I assume because it's not a supported type). How do I create a form that
includes media?
Many thanks.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/form-for-nested-entity-tp4264623p4264623.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: form for nested entity
Posted by sockmonster <ol...@gmail.com>.
Thanks Thiago, that worked a treat :)
--
View this message in context: http://tapestry.1045711.n5.nabble.com/form-for-nested-entity-tp4264623p4271479.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: form for nested entity
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 25 Mar 2011 18:15:18 -0300, Kalle Korhonen
<ka...@gmail.com> wrote:
> Using BeanEditForm? Customize the block for the corresponding Media
> property, there's an example at the end of the relevant documentation
> page:
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/BeanEditForm.html.
> Also, Tynamo's tapestry-model (http://tynamo.org/tapestry-model+guide)
> handles displaying most of the aggregate entity forms out-of-the-box.
Another option, more suited if you just have one such form in your
application, is to not use BeanEditForm and use a Form and two BeanEditors
instead:
<form t:type="Form">
<div t:type="BeanEditor" t:object="item"/>
<div t:type="BeanEditor" t:object="item.media"/>
<input type="submit"/>
</form>
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: form for nested entity
Posted by Kalle Korhonen <ka...@gmail.com>.
Using BeanEditForm? Customize the block for the corresponding Media
property, there's an example at the end of the relevant documentation
page: http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/BeanEditForm.html.
Also, Tynamo's tapestry-model (http://tynamo.org/tapestry-model+guide)
handles displaying most of the aggregate entity forms out-of-the-box.
Kalle
On Fri, Mar 25, 2011 at 11:31 AM, sockmonster <ol...@gmail.com> wrote:
> Hi, I have a question about forms. I want to create a form for an entity
> class, however the entity class contains references to other entities. For
> example:
>
> class Item {
> long id;
> String name;
> String desc;
> Media media;
> ...
> }
>
> class Media {
> String filename;
> String type;
> ...
> }
>
> When I create a form for the Item entity it leaves out the Media reference
> (I assume because it's not a supported type). How do I create a form that
> includes media?
>
> Many thanks.
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/form-for-nested-entity-tp4264623p4264623.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org