?? helloclient.java
字號:
package com.wiley.compBooks.roman.session.helloworld;
import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import java.util.Properties;
/**
* This class is an example of client code which invokes
* methods on a simple stateless session bean.
*/
public class HelloClient {
public static void main(String[] args) {
try {
/*
* Get System properties for JNDI initialization
*/
Properties props = System.getProperties();
/*
* Get a reference to the HelloHome Object - the
* factory for Hello EJB Objects
*/
Context ctx = new InitialContext(props);
HelloHome home = (HelloHome) ctx.lookup("HelloHome");
/*
* Use the factory to create the Hello EJB Object
*/
Hello hello = home.create();
/*
* Call the hello() method, and print it
*/
System.out.println(hello.hello());
/*
* Done with EJB Object, so remove it
*/
hello.remove();
} catch (Exception e) {
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -