Eclipse Development EJB Instance

Source: Internet
Author: User
Tags jboss

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.