Operating Environment:
1, JDK: to http://java.sun.com download, here use j2sdk1.5
2, JBoss: To http://www.jboss.org download, here use jboss-4.0.2
3, Eclipse: to http://www.eclipse.org download, here use Eclipse-sdk-3.1-win32
4, MyEclipse: To http://www.myeclipse.com download, here use MyEclipse 3.63
5, Designer: To download, here use designer_v4.0.1_for_eclipse3.1
The first part creates an EJB server-side program using MyEclipse under Eclipse
FILE->NEW->OTHER->MYECLIPSE->J2EE PROJECTS->EJB Project, as shown in the following illustration:
Click Next, Name, select the path, then hit finish. This creates an EJB project and clicks on the project to create a new stateless session bean.
The right mouse button new->other->myeclipse->ejb->eession Bean->next, as shown in the following figure:
Fill in the Bean name, package name, finish
Business methods for writing session beans:
Package WO.EJB;
Import java.rmi.RemoteException;
Import javax.ejb.EJBException;
Import Javax.ejb.SessionBean;
Import Javax.ejb.SessionContext;
public class Wo implements Sessionbean {
Private Sessioncontext context;
Public Wo () {
Super ();
}
public void Setsessioncontext (Sessioncontext newcontext)
Throws Ejbexception {
context = Newcontext;
}
public void Ejbremove () throws Ejbexception, RemoteException {
}
public void Ejbactivate () throws Ejbexception, RemoteException {
}
public void Ejbpassivate () throws Ejbexception, RemoteException {
}
Public String HelloWorld () throws Ejbexception {
Return "haha,i am Good";
}//Business approach to complete the actual function
}
After writing the business method, other configuration files and interface files can be automatically generated using MyEclipse, and the resulting method is as follows:
Click Project Right button->properties->myeclipse-xdoclet->configuration->add standard-> Standard EJB, OK after the original left margin generated standard EJB, left key point live, the following two boxes are