I agree with Gregor. The ActionForm beans are best left as ActionForm
beans, and used only as an extension of the html:form tags. Once the
data is validated, it should be transferred to persistent stoarge, or to
another bean that is not bound to the HTTP layer (and could be re-used
in other environments). This bean can then use the right data-type for
the job, and perform other business tasks that have nothing to do with
gathering input from HTTP. 

On the way back, a good way to repopulate an ActionForm bean, or other
string-based helper, is to have your data access objects return a Map,
and then use it with the standard BeanUtils.populate() method. Struts
does the same thing with the HTTP request, which is basically a Map.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/

Gregor Rayman wrote:
> 
> "Juha Paananen" <[EMAIL PROTECTED]> wrote:
> 
> > I want to fill in a form JavaBean using a struts form, and after
> > validating it in my Action class, store it into the db using a session
> > EJB component. The proble here is that I have to extend ActionForm class
> > to make the bean work with Struts.
> 
> You can use containment instead of inheritance. You should avoid using
> Struts ActionForm on the business logic level.
> 
> --
> gR

Reply via email to