This works fine as long as you do not have any child objects that need to be created. What if actionContact is null? Then all child objects are also null.
Mathias -----Original Message----- From: Matt Ho [mailto:[EMAIL PROTECTED] Sent: dinsdag 8 juli 2003 19:18 To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Model Driven Actions BOGAERT Mathias wrote: > Also, currently our tag libraries don't support getting and setting > business objects, only identifiers. So you still have to translate > manually. I don't agree that this is something that the tag libraries should support directly beyond the facilities provided (see Jason's comments). Retrieving business objects is a business process which I think should be kept separate from the tag libs. Having said that, I typically do something like the following: public class UpdateContactAction implements Action, ModelDriven { private Contact contact = new Contact() ; private ContactManager contactManager; public UpdateContactAction(ContactManager contactManager) { this.contactManager = contactManager; } public Object getModel() { return this.contact ; } public void execute() { this.contactManager.update(contact); } } ContactManager would be implemented as: public class DefaultContactManager implements ContactManager { private PersistenceManager persistenceManager; public DefaultContactManager(PersistenceManager persistenceManager) { this.persistenceManager = persistenceManager ; } public void update(Contact contact) { Contact actualContact = (Contact)persistenceManager.load( Contact.class, contact.getContactId()); // copy mutable fields // save actualContact } ... } M > > For example: > > You have a create customer screen in which you select a parent company > (which is a object list from the action). The select box has > listKey="name" and listValue="id" (defined in reverse because of a > quirck with the select HTML tag). There is currently no way to lookup > the original company object again from the id when the form gets > submitted (<property value="1">BlahCompany</property>). So > setCompanyId is called, and then in doExecute I manually do a lookup > for the company and assign it to the customer object. > > How are you guys doing this? > > Mathias > > -----Original Message----- > From: Matt Ho [mailto:[EMAIL PROTECTED] > Sent: dinsdag 8 juli 2003 18:29 > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] Model Driven Actions > > > I've updated the wiki to include docs on ModelDriven and the > ModelDrivenInterceptor. > > http://wiki.opensymphony.com/space/Xwork+Interceptors > > M > > Jason Carreira wrote: > >>The idea is to separate the setting of the model into the valuestack >>into an optional interceptor. In this way, you can customize the order >>of interceptors so that you can (and this is the example Matt had that >>led to us talking this through) set your static params (the params >>from your xwork.xml) then the action can use these params to decide >>which model type to build when getModel is called to get the model to >>put into the ValueStack when the ModelDrivenInterceptor is applied. >> >>If you have a model with children, you need to use sub-property field >>names, for instance "customer.address.street". >> >>Now that the wiki is back up, we need to go back and document this. >> >>Jason >> >> >> >>>-----Original Message----- >>>From: BOGAERT Mathias [mailto:[EMAIL PROTECTED] >>>Sent: Tuesday, July 08, 2003 10:15 AM >>>To: Opensymphony-Webwork ([EMAIL PROTECTED]) >>>Subject: [OS-webwork] Model Driven Actions >>> >>> >>>Hi guys, >>> >>>I've seen the ModelDrivenInterceptor. Can someone explain it's >>>intented usage? How do I do the CRUD thing using Model Driven >>>Actions? What is your approach to a model which has children (eg. >>>Customer Obj - Address Obj - Street String)? >>> >>>Thanks, >>>Mathias >>> >>> >>>------------------------------------------------------- >>>This SF.Net email sponsored by: Free pre-built ASP.NET sites >>>including Data Reports, E-commerce, Portals, and Forums are available >>>now. Download today and enter to win an XBOX or Visual Studio .NET. >>>http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_06 >> >>1203_01/01 >>_______________________________________________ >>Opensymphony-webwork mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork >> >> >>------------------------------------------------------- >>This SF.Net email sponsored by: Free pre-built ASP.NET sites including >>Data Reports, E-commerce, Portals, and Forums are available now. >>Download today and enter to win an XBOX or Visual Studio .NET. >>http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/ >>01 >>_______________________________________________ >>Opensymphony-webwork mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > www.parasoft.com/bulletproofapps > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > ------------------------------------------------------- > This SF.Net email sponsored by: Parasoft > Error proof Web apps, automate testing & more. > Download & eval WebKing and get a free book. > www.parasoft.com/bulletproofapps > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork