Steve Raeburn wrote:
Thanks, but that's not what I'm trying to accomplish.

It's very common to place beans into session or application scopes with
names such as "org.apache.struts.action.ACTION_MESSAGE". This is similar to
the Java package naming convention and accomplishes the same purpose of
avoiding name collisions.

In order to access the bean, you need to be able to specify a dotted name,
but you might not always know in which scope it will be found. Hence the
need to be able to specify a dotted bean name in EL.

The problem is that either EL interprets the string as a path to a nested
property or, if you escape the string, as a literal string.

Ultimately, I need to be able to access the
PageContext.findAttribute(java.lang.String name) method using EL, but as
this method does not meet bean property naming conventions I can't even do
something like ${pageContext["dotted.name"]}.

It's true you can't do find attribute with a dotted-name. If you want to jury rig something, do this...


========================================
<%!
static class AttributeFascade extends HashMap {
    PageContext context;
    public AttributeFascade(PageContext context) {
        this.context = context;
    }

    public Object get(Object key) {
        return context.findAttribute(key);
    }
}
%>

<%
pageContext.setAttribute("finder", new AttributeFascade(pageContext));
%>

<c:out value="${finder['dotted.name']}" />

========================================

You can flesh out AttributeFascade if you want to implement more methods on Map, maybe make it a regular class, maybe have a taglib that sets this for you, e.g.,

<foo:attributeFascade var="finder" />

Anyway, just a thought on how to do this if you must. As you can see, you start bending the brain in on itself, so that's part of why it was left off of the spec. ;)

--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to