leonnewsgroup wrote:

Thanks for your reply.
It is better to use a delegate or a manage layer than use a Struts
Action class. And I want to make sure that when I implement the delegate or
manage layer, I shouldn't use J2EE instead of POJO, it is correct?

Tim



Well, a facade is supposed to be a black box, so you shouldn't have to, for example, do an EJB lookup, to use the facade. It's supposed to be easily accessible from any implementations of the next higher layer (in other words, it makes stuff pluggable).


By the way, I would also like to say that adding layers and decoupling, a widely used and useful technique, doesn't always work or make sense. Rick Reumann was arguing not that long ago on another thread that sometimes trying to get HTTP knowledge out of web app components is more trouble than it's worth. Well, in similar vein, I have had success building a (graphical) interface basically right on top of a network protocol (I'm not speaking of HTTP in this case though). Sometimes an event-driven interface (dialogs that react to packet arrivals) is just the easiest and fastest way to go. I still think you should exercise your brain (what happens when I do/don't want EJB here anymore, what happens when I introduce a different type of interface, what happens when I change persistence techniques, what happens when I change from a stateless to a stateful protocol, what happens when I switch from Struts to Webwork >:o , etc.), but I avoid adding abstractions until prototyping/whiteboarding fleshes out the need for them. Always Be Prototyping! You'll always have a working version of your app that way, and your best design will actually come from having tried all the runners-up, rather than just your imagination.

Erik


----- Original Message ----- From: "Erik Weber" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Tuesday, March 01, 2005 5:03 PM
Subject: Re: Struts and EJB integration question?





I think it depends on your service locator design and API. The goals are
ease of maintenance, reusability/decoupling and performance. Is the
extra layer going to facilitate reuse of your service locator/EJBs? If
so then it's probably worth it because it probably won't cost much in
terms of maintenance and performance (depends on your infrastructure of
course). Might you have other services that don't require the service
locator API or a different service locator API? If that's the case,
again, you'd probably want to have Struts talk to a "manager layer"
component (or as Robert Taylor suggests -- an app-specific delegate
right in front of the manager layer component), and let this component
find and use services directly, etc. This shields Struts from disparate
APIs.

Erik


leonnewsgroup wrote:



Hi there,

I am building a Struts based application with EJB model. I want to know


the


strategy of find and call the EJBs in model layer. My model layer is
implemented by a stateless or stateful session bean that accesses to


entity


beans. and there is a service locator object to find the session beans.


My


questions are where to put the code to use the service loactor to find


the


session beans? is it in the Struts Action classes or another delegate


class?


Thanks.

Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to