You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Liam Morley <lm...@gdc.wpi.edu> on 2002/06/28 16:49:52 UTC
Re: AW: JNDI - What resources are loaded?
JNDI, a standard extension for Java, stands for Java Naming and
Directory Interface. The website at Sun's page:
http://java.sun.com/products/jndi/ explains it a lot more than I could.
Best of luck,
Liam Morley
Power-Netz (Schwarz) wrote:
>OT: what is JNDI ???
>
>
>
>>>Is there a way to list all of the JNDI Resources that are loaded for a
>>>particular context?
>>>
>>>
>>Sure.
>>
>>Here is a snipp from my "JNDI browser" JSP:
>>
>><%@ page
>> info="JNDI browser"
>> import="javax.naming.*, javax.sql.*, java.sql.*"
>> contentType="text/html; charset=windows-1250"
>>%><%!
>>static public String DEF_CPATH = "java:/";
>>%><%
>>//String contextPath = "java:comp/env/jdbc";
>>String contextPath = request.getParameter( "cpath" );
>>if( contextPath == null ) {
>> contextPath = DEF_CPATH;
>>}
>>%>
>><html>
>><head>
>><title>Test - JNDI browser</title>
>><meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
>></head>
>>
>><body bgcolor="#FFFFFF" text="#000000">
>><h1>JNDI browser</h1>
>><p>Context looked up: <strong><%= contextPath %></strong></p>
>><%
>>InitialContext initCtx;
>>Context envCtx;
>>
>>initCtx = new InitialContext();
>>if( (envCtx = (Context)initCtx.lookup( contextPath )) == null ) {
>> out.println( "<p>No " + contextPath + " context</p>" );
>>} else {
>> NamingEnumeration enum = initCtx.listBindings( contextPath );
>> int i = 1;
>>%>
>><table width="100%" border="1" cellspacing="0" cellpadding="3">
>> <%
>> while( enum.hasMore() ) {
>>%>
>> <tr>
>> <td><%= i %></td>
>> <td><%= ((Binding)enum.next()).toString() %></td>
>> </tr>
>><%
>> }
>>%>
>></table>
>></body>
>></html>
>>
>>Nix.
>>
>>
>>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>