Link to home
Start Free TrialLog in
Avatar of skip1000
skip1000

asked on

Some miscellaneous questions about J2EE 1.4 and deployment

Hi,

I'm looking at j2ee 1.4 tutorials and deployed a few examples.  Trouble is that I don't understand many things.  

1. For example,the ConverterApp example, under ConverterWAR object, EJB Ref tab, there are the Home Interface and the Local/Remote Interface.  The value of Home Interface is "converter.ConverterHome."  What does the "converter." preceding ConverterHome refer to?  Is is a directory, is it a path for the url using context root as the reference point or what?

2. For a simple JSP app w/ one entity bean and one table (used pointbase), do I have a need for a JAR file or do I only need a WAR file?

3. My jsp page begins w/ the following line:

      <%@ page import="converter.Converter, converter.ConverterHome, javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>

What does "converter." in "converter.Converter" from above stand for?  Again is it a directory, a url reference or what?

4. In a JSP file, I have the following code:
         Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");

What does "java:comp/env/ejb/TheConverter" refer to?

5. Do all JSPs require jspInit() and if not, when not needed?

6. Why is it that Context Root is sometime preceded by a "/" as in "/converter" and sometimes not?

7. When do you need to enter information into the Resource Ref's (tab) section for a WAR file (eg. jdbc/ItemDB as coded name)?
ASKER CERTIFIED SOLUTION
Avatar of kiranhk
kiranhk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skip1000
skip1000

ASKER

Hi Kiran,

Thanks for your response.  I want to elaborate a little more:

1) Speaking of packages, I noticed that some ejb java files contain the following line of code as in this example:

      package converter;

The converter refers to the directory converter right?  When do you need to include it in the java files?  Do you include them when the client file, say Client.class and index.jsp file is 1 level above the ejb directory (in this case the converter directory)?  For example, Client.class and index.jsp is in C:\temp\ dir and ConverterBean.class is in c:\temp\converter\ dir

2) Does the Sun deployment tool create all the xml descriptor files I need for a simple app w/ 1 jsp, 1 ejb, and 1 table -- jsp just output content of table to page using ejb.

6) When do you need the "/" as in "/Converter".  I've also seen context root w/o the "/".

Thanks.
Avatar of TimYates
1)
I think you are confused about packages...

http://java.sun.com/docs/books/tutorial/java/interpack/packages.html
http://mindprod.com/jgloss/package.html

Should help...yes, it is to do with directory, but that is not really the point...  It's more a way of keeping classes together in a structured way so you can import just those classes which perform a certain function

2)
I think the sun deployment tool only does EJB jar files, so won't have anything to do with your jsp

6)
Normally (in your JSPs), you won't need to put the context "/Converter", as you will already be there...
1) Check out the answer by TimYates or check out the J2SE tutorial from the link which i gave you.
2) Which deployment tool are you speaking of?? is it the Sun Reference Implementation Server or u have other Application Servers like Weblogic, Websphere or Jboss.
Check out the code from the links below. The XML deployment descriptors can be taken from any of these sample code and modified according to your classes.

http://dev2dev.bea.com/code/ejb.jsp

http://www.bablokb.de/ejb/

6) In your JSP if you refer to anything like other JSP/JPEG images etc..  with a "/" like "/converter" it means it will take from the root context like it will be appended after http://localhost:8080/converter
If you dont refer to it with a "/" it means it is the relative path which is taken from the path of the current JSP/Servlet you r executing


hope this helps