//TODO: import JNDI related classes like initial context, context, naming exception etc
import java.util.Hashtable;
public class ListJNDI {
public static void main(java.lang.String[] args) {
// Check to see if any context names have been passed via the command line
// if not, use the root context for the search
String name;
if ((args.length < 1) || (args == null)){
name = "";
}
else {
name = args[0];
}
Hashtable env = new Hashtable();
try { //TODO: obtain an initial context
printContext(name,initialContext, 0);
}
catch (NamingException e)
{
System.out.println(e);
}
}
//TODO: recursively process all subcontexts of the provided context
public static void printContext(String name, Context dir, int numLevelsDeep)
{ try {
} catch (NamingException e) {
System.out.println("Exception");
System.out.println(e);
}
}
}
import java.util.Hashtable;
public class ListJNDI {
public static void main(java.lang.String[] args) {
// Check to see if any context names have been passed via the command line
// if not, use the root context for the search
String name;
if ((args.length < 1) || (args == null)){
name = "";
}
else {
name = args[0];
}
Hashtable env = new Hashtable();
try { //TODO: obtain an initial context
printContext(name,initialContext, 0);
}
catch (NamingException e)
{
System.out.println(e);
}
}
//TODO: recursively process all subcontexts of the provided context
public static void printContext(String name, Context dir, int numLevelsDeep)
{ try {
} catch (NamingException e) {
System.out.println("Exception");
System.out.println(e);
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货