• EJB 3.0 + JBOSS 5.1


    最简单的Hello

    FirstEjb.java

    1.定义一个接口
    public interface FirstEjb {
    public String saySomthing(String name);
    }

    2.实现定义的接口
    @Stateless
    @Remote
    public class FirstEjbBean implements FirstEjb {
    public String saySomthing(String name) {
    // TODO Auto-generated method stub
    return "你好," + name;
    }
    }

    3.Client.java
    public class FirstEjbClient {
    public static void main(String[] args) throws Exception {
    Properties props = new Properties();
    props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
    props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
    props.put("java.naming.provider.url", "localhost");
    InitialContext context = new InitialContext(props);
    //FirstEjb firstEjb = (FirstEjb)context.lookup("FirstEjbBean/remote");
    //System.out.println(firstEjb.saySomthing("刘瑞超"));
    }
    }
  • 相关阅读:
    thinkphp 模板文件
    thinkphp 目录安全文件
    thinkphp 防止sql注入
    thinkphp 表单令牌
    thinkphp 表单合法性检测
    thinkphp 输入过滤
    thinkphp 静态缓存
    thinkphp sql解析缓存
    thinkphp 查询缓存
    thinkphp 快速缓存
  • 原文地址:https://www.cnblogs.com/liuruichao/p/4005867.html
Copyright © 2020-2023  润新知