This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 219
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
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: When form beans are populated and can we merge form beans with action class?
 
Similar Threads
Doubt with Struts:complete reference
Using HTML:Multibox
Doubts ...understanding the struts architecture :(
Domain Object as Strtus Action form.
What's the best way to handle multiple Java bean instance in Jsp?