📄 jndicreator.java
字号:
/* * 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -