Hi Hubert, I checked out your FormDef project, looks interesting. I need something like this for my dialog/wizard classes, and your project seems to fit. Few questions though. I did not look in the source code yet, but I read your doc page.
What I do is I have a dialog/wizard bean, which is stateful, that is, is stored on the server in the session. Currently I store reference to this bean in the form bean, and the bean has String getters/setters. I use strings, because even if the input was incorrect, I still store input data in the bean, because I always dislpay what is in the bean, not what is in the action form (though the bean itself is stored in the action form). Action form itself has session scope to ensure that bean is not removed. I use nested properties to set request data in the dialog bean, and to show it on a page. If I could easily copy data between action form and my dialog bean, then I could make my bean's fields strongly typed (non-string). But looking on your example, it seems that I need to recreate the dialog bean and the action form each time I do the copy: Employee employee = (Employee) FormDefUtil.getFormValues(form, this, mapping, request); I cannot recreate the bean every time not only because I do not want to ;) but also because certain fields can be updated when my dialog is in certain state, so I cannot recreate it each time and fill _all_ fields. * Is it possible to have a method, which would accept a reference to an existing bean? * Is it possible to either define which fields should be mapped, or to map only fields which were received in the current request? * Is it possible to define a method name for a form (probably of some static helper class), which would return erorr messages? I want this, because in my case validation must be done within the dialog bean, it returns list of errors, not an ActionErrors object, to make it more portable. I would like to be able to provide a conversion method, which would receive reference to my dialog bean, and would return ActionMessages object. If all this is described in the docs or in the source, I would appreciate the pointer. Thanks, Michael. On 5/27/05, Hubert Rabago <[EMAIL PROTECTED]> wrote: > If you only store your form in request scope, Struts will create a new > form object when the user submits it. It would also mean it will > create a new instance of your business bean. To avoid this, you might > consider placing your bean in session scope. Either way, though, > you'll still have conversion issues to tackle if your business bean > contains non-String fields, such as Dates or other custom objects. > For those, you should register add'l Converter objects (BeanUtils > comes with one for Date objecs). > Take a look a FormDef (https://formdef.dev.java.net). Right now it > doesn't allow you to selectively expose certain attributes, but it > does define form beans based on the fields you have in your business > beans. It might give you other ideas on how to deal with this issue. > > Hubert > > On 5/27/05, Nils Liebelt <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > could I speed up my development by placing "business" beans inside a form > > bean using delegating methods to set it. I could init the "business" bean > > with a none bean method and only expose certain attributes of course > > validating the way i need it. I am interested if I place such a construction > > inside the request scope and submit the corresponding form. Is my nested > > business object then still available or does Struts create a new form with > > the set parameter? > > > > > > Regards, > > > > Nils > > > > > > --------------------------------------------------------------------- > 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]