tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torgeir Veimo <torg...@vertech.no>
Subject using self created Context with jndi taglib
Date Fri, 16 Mar 2001 10:24:34 GMT
I'm trying to use the jndi taglib with a context that comes from my own
context pool.

The code is included below. But I guess that the context needs to be
references in the PageContext in order to be found by the tag?

Is there an easy way to do this? I plan to create a tag that fetches a
context from my context pool later, but for now it would be nice to be
able to put a context into the pagecontext temporarily.


<%@page contentType="text/html" import="profile.*, javax.naming.*" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/jndi" prefix="jndi" %>
<html>
<head><title>Profile</title></head>
<body>

<h3>Profile for </h3>

<%
    ContextPool ctxPool = (ContextPool)
session.getAttribute("contextPool");
    System.out.println("context pool retrieved: " + ctxPool);

    System.out.println("using dn: " +
request.getSession().getAttribute("username") 
        + ", credentials: " + 
request.getSession().getAttribute("credentials"));

    Context testCtx =
ctxPool.getContext((String)request.getSession().getAttribute("username"), 
        (String)request.getSession().getAttribute("credentials"));

    System.out.println("context retrieved: " + testCtx);
        
%>

<jndi:lookup contextRef='testCtx' name='uid=test, ou=people,
o=ecomda.de' id="hmm" /> 

<!-- doesn't work. the testCtx is not found. The exception is included
below -->

 
</body>
</html>


javax.servlet.jsp.JspException: context not set in a lookup invocation
<...>

-- 
- Torgeir

Mime
View raw message