Search |
||
ActionForm or DynaActionForm - Making the choicePosted by srikanth on January 29, 2004 at 11:44 AM PST
Imagine a Struts 1.0 world where an ActionForm was absolutely needed even for prototyping an HTML form in JSP using Struts custom tags. Things were good until the separation of concern came into picture. In real life projects, different people play different roles. Application developers have the responsibility of developing Java code and page authors would exclusively prototype the page and its navigation using JSP markup tags. Since the Java code beingdeveloped is constantly changing, the developer does local builds on his machine. Similarly the page author would certainly like to add or remove fields from the prototype during the page design. Since the HTML forms map to ActionForms, the above scenario implies one of two things.
While the former hampers the developer productivity, the latter leads to overlap of responsibilities and headaches. Both options are not ideal. Struts 1.1 has solved this problem by introducing DynaActionForm. Although originally designed for developer’s ease of use, it has been serving the purpose of role separation in a project very well. One can envision an ideal project development as follows. DynaActionForm - Its all about being at right place at right timeA page author can be isolated from the Java application development by having a application server environment available for page design. He develops the JSPs as JSPs using the Struts (and other) custom tags, not just HTML prototypes. He also creates DynaActionForms using XML instead of relying on the application developer to create the Java ActionForms. In other words, the page author is isolated from the nitty-gritty’s of the build, deploy and all that chaos accompanying it – at least in the prototype phase. The page author designs the page Navigation as plain forwards instead of Form submissions; In other words he uses In Struts framework, the presentation logic resides in the Action classes. It is highly unlikely that the presentation logic (Action) for the ActionForm will be ready even before the prototype is ready. Hence the page author uses the Okay, so DynaActionForms are great, why replace them with ActionForms anyway? In my opinion, DynaActionForms are good only in the prototyping stage. Once past that stage, it is always better to have strongly typed ActionForms. Here are some some reasons why.
That said, DynaActionForms have an important role to play in the project lifecycle as I glossed over earlier, which they do best and let us limit them to just that. I use them with caution, only when I absolutely need them. »
Related Topics >>
J2EE Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|