You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Viral_Thakkar <Vi...@infosys.com> on 2003/08/01 07:04:52 UTC

Direct ValueObject creation rather than ActionForm.

I have a idea here. Why we require ActionForm class if we can have
ValueObject and that we can pass to the service layer.
 
Can we create the instance of ValueObject class only rather than
ActionForm instance from the request data?
 
Thanks
 
 

Re: Direct ValueObject creation rather than ActionForm.

Posted by Nagendra Kumar O V S <na...@ikigo.com>.
hello,
ActionForm is tightly coupled with the form elements on the jsp page
ActionForms helps us to get data to & from a jsp page.
if u don't have any form elements(html elements) there is no mandatory to
use ActionForm and u can use a ValueObject to populate the request data(if
any) and then pass on to service layer

-- nagi

-------Original Message-------

From: Struts Users Mailing List
Date: Friday, August 01, 2003 10:38:31 AM
To: struts-user@jakarta.apache.org
Subject: Direct ValueObject creation rather than ActionForm.

I have a idea here. Why we require ActionForm class if we can have
ValueObject and that we can pass to the service layer.
 
Can we create the instance of ValueObject class only rather than ActionForm
instance from the request data?
 
Thanks
 
 

RE: Direct ValueObject creation rather than ActionForm.

Posted by Andrew Hill <an...@gridnode.com>.
This is quite a common idea that many people new to struts have. There are
quite a few reasons why your ActionForm and your value object are different
objects. (Indeed the very reason ActionForm is implemented as a class rather
than an interface is specifically to discourage people from using their
ActionForm as a value object.) If you search the list archives you will see
numerous threads discussing the reasons why this is in fact a very bad idea
indeed.
  -----Original Message-----
  From: Viral_Thakkar [mailto:Viral_Thakkar@infosys.com]
  Sent: Friday, 1 August 2003 13:05
  To: struts-user@jakarta.apache.org
  Subject: Direct ValueObject creation rather than ActionForm.


  I have a idea here. Why we require ActionForm class if we can have
ValueObject and that we can pass to the service layer.



  Can we create the instance of ValueObject class only rather than
ActionForm instance from the request data?



  Thanks