| Author |
ejb call from Action or FormBean
|
ram data
Greenhorn
Joined: Mar 19, 2007
Posts: 3
|
|
Hello All, I am new to Struts world. From which class I need to call EJB? Is it from Action class or FormBean class Pls clarify Thanks Ram
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
In a Model/View/Controller framework such as Struts, an Action class is the main controller class that you write. The job of a controller class is to act as a mediator between the Model and the view. If you're using EJBs for your Model, it makes sense that the Action class becomes the client for your EJBs. It then sends information to the view based on what it retrieves from the EJB layer. An ActionForm is a class that is more tightly-coupled with the view, and therefore is not a good place to interact with a model-layer object such as an EJB.
|
Merrill
Consultant, Sima Solutions
|
 |
ram data
Greenhorn
Joined: Mar 19, 2007
Posts: 3
|
|
Thanks for the reply. But i am confused with the following link from ibm http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?topic=/com.ibm.etools.struts.doc/topics/cstrdoc001.html Could you clarify for me?
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
I glanced at the article, and there is a lot of good information there. I'm happy to clarify, but you'll have to tell me specifically what it is you find confusing about the article.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Ok, now I see what you mean. The article has a diagram showing a line between the business logic and the the form bean. All I can say is that I don't agree with the diagram. If I had drawn it, the line would be between the Action class and the business logic. While the ActionForm will certainly contain data sent from the model, it is the Action class that should control the interaction and then populate the ActionForm. It should not be populated directly from the model layer. For one thing, if you did this, you would introduce a dependency on Struts into your Model layer, which is not desirable.
|
 |
ram data
Greenhorn
Joined: Mar 19, 2007
Posts: 3
|
|
|
Thanks for the clarification
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
ram data, You're welcome. However, before posting again, there's something I'd like you to take care of. Since "ram data" is an obviously fictitious name, it is in violation of our naming policy, which we take quite seriously. Please change the "publicly displayed name" in youruser profile so that it conforms to the JavaRanch naming policy.
|
 |
 |
|
|
subject: ejb call from Action or FormBean
|
|
|