problems about ejb integrated with struts

i am a beginninger and interested in learning how to integrated ejb with

struts, but few questions make me confused.

while using struts, with its mvc model, developers are able to only code business logic in action stage and load actionForm, i.e. so called as model. then foward it to the view to jsp page. but how if i want to use ejb? for via integrated with ejb? for, as i know, the action sould be viewed as clients to interact with session bean, which shields entity bean from the client side. if thus,

the steps i guess ought to be, first, with initial context looking up remote object. second, via rmi 'narrow'*** its home object (not use local). third, create in returning remote stub for preforme business method.

if thus, do i still need model - actionForm? for if the clients invoke a method in session bean, for instance, then all computation has been accomplished via session bean. it seems that the actionForm becomes useless, doesn't it?

is that a wrong concept? or what is the correct strategy when intergated struts with ejb? i mean, how the action, actionForm and view are mixed up together well with ejb? i appreciate any suggestion.

thanks any advice.

[1221 byte] By [shogun1234] at [2007-9-27 16:46:24]
# 1

Steps that you described are very corroect but you are missing on a very important thing in the frame work.

See it Action and a SESSION bean that together make a controller for a true struct application.Try and see it like this.You have a jsp say jsp1 using Action.All properties present on jsp1 needs to have access and mutator methods on ActionForm. You use a Session bean to talk to all the CMP/BMP used in the application.You use Remote interface of Session Bean for communicating with Action and Session bean inturn uses Local interfaces for working with BMP/CMP. So you see for view component the Action becomes the controller and for Model components the Session bean act as controller.So you have Action and Session Bean together acting as controller in struct applcation. This is what you are missing out.

Now talking about ActionForms, this is a Form Bean for Value Bean whatever you fill more intutive to call it.This ActionForm object form is used by execute method of Action and is used to pass values of properties on the JSP1 to the BMP/CMP or model component. If you donot use ActionForm in here you'll have to write the set of access and mutator methods for session bean and passing the values to then would be real pain. So this is one important function of ActionForm. This helps implement the above mentioned architecture which struct aims at.So to pass the values of properties from a session layer to model component you need ActionForm which are simple to use.

I'll let you now more about this whenever i come across one.

This is what i can help you...do let me know if you get any more inputs on this

shriatul at 2007-7-6 1:04:24 > top of Java-index,Other Topics,Patterns & OO Design...