Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 - Difficulties in handling form data

 
Senthilkumar Adaickalam
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

we have developed a web application using struts 1.38 + spring + hibernate and we now want to migrate it into Struts 2. I went thro the struts 2 documentation and understand that formbeans have been removed completely from the framework. Without formbean, its fine for the forms having few fields but what will happen if the form has more number of data. Do we need to add setters and getters in action class for each field? If yes, i feel it decreases the productivity compare to the struts 1's dyna action forms where we just define the form in struts-config.xml.

Please clarify.
 
Joe Ess
Bartender
Posts: 9279
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Senthilkumar Adaickalam:
Do we need to add setters and getters in action class for each field?


No. My approach is to use the same POJO I use with Hibernate and make a get/set POJO method on the Action (see the CRUD Demo for an example).
I'm sure there's other ways to do it. ModelDrivenInterceptor for one.
[ April 23, 2008: Message edited by: Joe Ess ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic