Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts

 
ambarish reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

any one please answer this one.

In struts framework, is there any disadvantages using dyna validator form and dyna action forms?

[ June 22, 2007: Message edited by: ambarish reddy ]
[ June 22, 2007: Message edited by: ambarish reddy ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I personally don't like DynaActionForm and seldom use it except for "demo" type applications. The main things I don't like are:

- It's more verbose and more awkward to retrieve the value. You have to write:

instead of


- If you misspell something, the compiler doesn't catch it. In the above example, if I write dynaForm.get("customerNmae") the compiler won't correct me and I won't find out it's wrong until run time. If I write myForm.getCustomerNmae() the compiler will correct me.

- you have more flexibility with a regular ActionForm. If you want to do something fancy in a getter that will manipulate the format of the property, you can.

Furthermore, if you're using a good IDE such as Eclipse or NetBeans, writing an ActionForm is at least as easy as writing the XML to define DynaActionForm properties in the struts-config.xml file. All you have to do is define the properties and invoke the tool to create getters and setters.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ditto what Merrill said. I get annoyed by the "define it in xml and then you don't have to write any code" mentality...you still have to write code but now it is in xml and you get no help from your IDE or compiler.

- Brent
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic