是的,可以用ant或者一些IDE环境,比如JB
解决方案 »
- 如何获取json数据的未知key的名称
- 各位大虾s2sh问题求救
- axis怎么发布webservice
- spring中,我要修改struts2(session)值
- 请大家给提些参考
- 请教struts里ActionForm的问题
- jsp连接access数据库有没有驱动或jsp怎么连接access数据库
- 求有关Web Service的英文材料
- 巨菜问题:java文件在编译成class文件后用java.exe解释执行的时候遇到问题,请帮忙解决?在线等待!!!
- springmvc+spring+mybatis基础框架搭建
- java中有没有读写profile的api.高分
- >>>>>>>>>>>>>>>再加100分,请高人指教!<<<<<<<<<<<<
在JB环境下开发,发布,调试
package com.ziyang.ejb;
import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import java.util.*;
public class ProductClient {
public static void main(String[] args) throws Exception {
ProductHome home = null;
try {
Context ctx = new InitialContext(System.getProperties());
home = (ProductHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("RemoteProductHome"), ProductHome.class);
home.create("123-456-7890", "P5-350", "350 Mhz Pentium", 200);
home.create("123-456-7891", "P5-400", "400 Mhz Pentium", 300);
home.create("123-456-7892", "P5-450", "450 Mhz Pentium", 400);
home.create("123-456-7893", "SD-64", "64 MB SDRAM", 50);
home.create("123-456-7894", "SD-128", "128 MB SDRAM", 100);
home.create("123-456-7895", "SD-256", "256 MB SDRAM", 200);
Iterator i = home.findByName("SD-64").iterator();
System.out.println("The following product descriptions match the product name SD-64:");
while (i.hasNext()) {
Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
System.out.println(prod.getDescription());
} System.out.println("Calling finder to find all products that cost $200");
i = home.findByBasePrice(200).iterator();
while (i.hasNext()) {
Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
System.out.println(prod.getDescription());
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
if (home != null) {
System.out.println("Destroying products..");
/* * 查找所有products
*/
Iterator i = home.findAllProducts().iterator();
while (i.hasNext()) {
try {
Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
if (prod.getProductID().startsWith("123")) {
prod.remove();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}