Hello Gerry! Not an expert, just my two-penny! I'm a beginner with EJB too!
GS> Some topics I have run across while surfing and my thoughts. GS> ** Enterprise Java Beans - no in-house knowledge, so we would be learning GS> from the ground up. Do we need a server? Yup! Here I'm going to write some rubbish, plz, experts, correct me! Generally all the EJB containers may run in one of two ways: 1) EJB container run in the same jvm as the servlet container (then they communicate locally.) (requires tight integration between EJB and web containers) I guess that here it is enough to create initial context with a zero-arg constructor: new InitialContext(); and this is J2EE compliant. These are the things you need to do to make the ejb appear in your InitialContext: Declare that you webapp uses the ejb, this is like "declaring a variable" in a programming language in your web.xml either: - use a <ejb-ref> element this implies using the whole heavy and time-consuming marshalling machinery - use a <ejb-local-ref> element this implies skipping the whole marshalling machinery and working directly Then you should "assign a value" to the "variable", bind a EJB home interface to the webapp's JNDI context. You do it either 1a) - directly: you put a <ejb-link> element inside the <ejb-ref>, or <ejb-local-ref> element (I do not think this is a common scenario) 1b) - indirectly: you use some EJB+Web container specific way (often via a web interface and/or via additional deployment descriptors) 2) EJB container and web container run in different JVMs. They use tcp to communicate. (This allows web and EJB containers that were not pre-tuned for each other still cooperate, but then it is 2.2 not 2.1) The 2) section has two subsections: 2.1) EJB container and Web container are integrated closely enough. All is J2EE compliant. This is much like 1) variant, only you can not use <ejb-local-ref>, only <ejb-ref> 2.2) you have to create the InitialContext with plenty of parameters (fill a HashMap and pass it to the constructor). This is not J2EE. You create an InitialContext that is almost completely independent of what the web container has provided you with and it does have to initiate a new TCP connection. (This may be as slow as creating a new database connection, i guess) GS> Are they tough to code? Haven't tried it, but guess it should be a piece of cake :-) GS> How to get info from there to JavaBean for use in JSP? Here I'm a moron. Please, others, do correct me! Still you may ** have a normal JavaBean interact with a Enterprise Java Bean internally. Internally you create the InitialContext, do the look-ups and all the stuff You may use the Value object pattern in this case and probably save some time and network bandwidth. Although with 1a) variant the Value object pattern is not necessary. ** somewhere in the controller servlet (or in a jsp directly) you create the initial context, do the lookup, get an instance of remote (EJB 1.1 terminology) interface and bind it somewhere. I guess the best is as a request attribute. Then it behaves as a normal JavaBean and you may use it. I guess that especially with 1a) variant this is a feasible solution GS> ** Placing function in each JavaBean to retrieve information from the GS> database and save info to the database. - Some questions on using the GS> connection pooling, but I think I could work through this. Yes, and I advise you to use JNDI to lookup the DataSource instances and get the connectins from them. This is J2EE compatible. As with EJBs you put some entries into the web.xml file and do some setup that is web-container specific. I guess that because it is much simpler then EJBs it becomes wider and wider available. I guess that Tomcat 4.0.1 and Resin 2.0.4 do have this, not speaking of WAS and Weblogic. GS> Is it still a GS> JavaBean if I do this (add a populate and commit methods). Yup! :-) GS> ** Others but nothing that I can think of right now. You can kick the ejb-s aside and use normal objects that encapsulate database access. You can bind them say to request to pass from servlet container to jsp-s and probably use scriptlets <% %> to get hold of them and <%= %> to get data from them. GS> I am open for suggestions. Actually what I would really like is a location GS> online where I can research this a bit more. Upps, let others help you with this :-) - Anton [EMAIL PROTECTED] [EMAIL PROTECTED] P.S. Just after writing the answer I noticed your mail address: APRIL1.NET!!! Are you kidding us? :-)) P.P.S. Questions that I would like to hear answers too are: - I just do not know if variant 2.1) actually happens in real life. I just do not know if WAS and Weblogic are 1) or 2.1). Plz, tell me! (I'm sure that 1) exists, JBoss+Tomcat4.0.1 give an example and that 2.2) exists, Resin may work in this fashion with great many EJB containers) - I know that if we download JBoss+Tomcat4.0.1 from jboss.org it may all work and may be work in the 1) way. I guess that Tomcat may well work as 2.2), I guess that any web container will work 2.2) The question is: are there any other ways to make Tomcat run 1) then using the JBoss+Tomcat install? Does Tomcat run in the 2.1) mode? If not for both questions, then how can Tomcat be a reference implementation while Servlet 2.3 requires JNDI app context described in J2EE version 1.3 and it requires support for <ejb-ref> and <ejb-local-ref>? - Can Resin be made run 1) or 2.1)? I guess the currently it can not. =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com