<%@page contentType="text/html"%>
<html>
<head><title>jndi - external resource sample</title></head>
<body>

<%@ page language="java" import="org.apache.naming.resources.*,java.io.*,javax.naming.*,samples.jndi.externalResource.*" %>

<%
     Context initContext = new InitialContext();
     Context envContext = (Context) initContext.lookup("java:comp/env");
     Resource file = (Resource) envContext.lookup("bean/MyExternalConnectionFactory");
     InputStream is = file.streamContent();
     String length = String.valueOf(is.available());    
 %>
 
<h2>File length is <%=length%><h2>
</body>
</html>
