try {
PrintWriter pw = response.getWriter();
try {
Context ctx = new InitialContext();
ctx.createSubcontext("foo");
ctx.bind("foo/bar", "value");
String value = (String) ctx.lookup("foo/bar");
if ("value".equals(value)) {
pw.println("Value bound and retrieved from jndi default context");
} else{
pw.println("Value not bound or not retrieved from jndi default context");