File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When form beans are populated and can we merge form beans with action class?

 
Kousik Majumder
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to struts.
I want to know the followings:-

1. When in struts flow form beans are populated and who does it?
2. As because form beans sole responsibility is to get and set data can we merge it with Action class ?

 
Ankit Garg
Sheriff
Posts: 9496
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. When in struts flow form beans are populated and who does it?

They are populated before your action is called (not sure exactly when). Its the responsibility of struts to set its values (not sure exactly how, its done using interceptors in struts 2, must be a similar approach in struts 1 too)
2. As because form beans sole responsibility is to get and set data can we merge it with Action class ?

I'm not sure if this can be done in struts 1 (easy to do in struts 2). Try to make the action as a form bean declaration in your struts-config file. Still you'll have to use the FormBean object passed as parameter to the action. You can't use properties of your action in JSPs directly...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic