jndicreator.java
来自「想学习EJB的同学」· Java 代码 · 共 47 行
JAVA
47 行
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ejb3.day2.dwr;import javax.naming.Context;import javax.naming.InitialContext;import org.directwebremoting.create.AbstractCreator;/** * * @author user */public class JNDICreator extends AbstractCreator { private String jndiName; private String typeClass; @Override public Class getType() { try{ return Class.forName(typeClass); }catch(Exception e){ throw new RuntimeException(e); } } public void setTypeClass(String type){ this.typeClass = type; } public void setJndiName(String jndiName){ this.jndiName = jndiName; } @Override public Object getInstance() throws InstantiationException { try{ Context ctx = new InitialContext(); return ctx.lookup(jndiName); }catch(Exception e){ throw new InstantiationException(e.getMessage()); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?