-
-
Save araujodavid/b90807c8609af0f75da1aad53512aca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@page import="javax.naming.*"%> | |
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>JNDI Resources</title> | |
</head> | |
<body> | |
<h1>JNDI Resources</h1> | |
<h2>Context ""</h2> | |
<ul> | |
<% | |
Context ctx = new InitialContext(); | |
NamingEnumeration<NameClassPair> list = ctx.list(""); | |
while (list.hasMore()) { | |
out.println("<li>"); | |
out.println(list.next().getName()); | |
out.println("</li>"); | |
} | |
%> | |
</ul> | |
<h2>Context "java:"</h2> | |
<ul> | |
<% | |
Context javaContext = (Context)ctx.lookup("java:"); | |
list = javaContext.list(""); | |
while (list.hasMore()) { | |
out.println("<li>"); | |
out.println(list.next().getName()); | |
out.println("</li>"); | |
} | |
%> | |
</ul> | |
<h2>Context "java:/comp/env"</h2> | |
<ul> | |
<% | |
Context envContext = (Context)ctx.lookup("java:/comp/env"); | |
list = envContext.list(""); | |
while (list.hasMore()) { | |
out.println("<li>"); | |
out.println(list.next().getName()); | |
out.println("</li>"); | |
} | |
%> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment