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

ActionForm

 
Phillipe Rodrigues
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the role of ActionForm in Struts?What does the below statement mean?
Struts reuses ActionForms instead of creating new ones for each request
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Philippe,

Struts uses ActionForms to transfer the request parameters from the client to the execute() in the Action class on the server. It abstracts the usage of the HttpRequest.getParameter() which had to be used to retrieve each individual parameter till the Struts came along. The request parameters could then be processed as appropriate.

The reuse part means that Struts does not create new instances of the Form bean mapped to a particular form. If one is available it is used after calling the reset() method the nest time the same form is submitted.

Cheers,
Raj.
[ July 10, 2008: Message edited by: Raj Kamal ]
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously the ActionForm is nothing but the carrier for the having the values set in the HTML form and which is what getting bound to the appropriate properties of the Form Bean you have. Instead of recreating new ActionForms, it is better reused!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic