helloworldbean.java

来自「实现一个简单的helloworld的EJB」· Java 代码 · 共 82 行

JAVA
82
字号
package server.ejb.services;

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

import javax.ejb.CreateException;

/**
 * @ejb.bean name="HelloWorld"
 *           display-name="Name for HelloWorld"
 *           description="Description for HelloWorld"
 *           jndi-name="ejb/HelloWorld"
 *           type="Stateless"
 *           view-type="remote"
 */
public class HelloWorldBean implements SessionBean {

	public HelloWorldBean() {
		super();
		// TODO Auto-generated constructor stub
	}

	public void setSessionContext(SessionContext ctx)
		throws EJBException,
		RemoteException {
		// TODO Auto-generated method stub

	}

	public void ejbRemove() throws EJBException, RemoteException {
		// TODO Auto-generated method stub

	}

	public void ejbActivate() throws EJBException, RemoteException {
		// TODO Auto-generated method stub

	}

	public void ejbPassivate() throws EJBException, RemoteException {
		// TODO Auto-generated method stub

	}

	/**
	 * Default create method
	 * 
	 * @throws CreateException
	 * @ejb.create-method
	 */
	public void ejbCreate() throws CreateException {
		// TODO Auto-generated method stub
	}

	/**
	 * Business method
	 * @ejb.interface-method  view-type = "remote"
	 */
	public String sayHello() {
		// TODO Auto-generated method stub
		return "Hello World!!\r\nHelloWorld2" +
				"sadfdsfasdfdsfdsfsdfdfs" +
				"dfsdfsdfsdgfggfdgfsdfsdf" +
				"asdfefrefdsfdsgsfgasdfgfgfg" +
				"asdffafgfgfggggggfffffffffffffffffff" +
				"fgeragasfgsgfsadfsadf" +
				"asdfsagfagafgsafgsffsadfsaf" +
				"sdfgsadgafgasfgfdsfdsfsda";
	}
	/**
	 * Business method
	 * @ejb.interface-method  view-type = "remote"
	 */
	public String sayHello2(int n) {
		// TODO Auto-generated method stub
		return "Hello World!"+n;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?