aspose file tools*
The moose likes Struts and the fly likes When form beans are populated and can we merge form beans with action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "When form beans are populated and can we merge form beans with action class?" Watch "When form beans are populated and can we merge form beans with action class?" New topic
Author

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

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
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 ?


Thanks in Advance,
Kousik
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When form beans are populated and can we merge form beans with action class?