方法一
當應用服務器初始化servlet實例之後
例如
public class ControllerServlet extends HttpServlet {
private javax
public void init(ServletConfig config)
throws ServletException
{ super
Context ctx = null;
try {
ctx = new InitialContext();
testDS = (javax
}
catch(NamingException ne) {
ne
catch(Exception e) {
e
}
public javax
{ return testDS;
}
}
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20517.html