Hello,

I finally found what I was looking for:

        Child child = new Child();
        Parent parent = new Parent();
        parent.setName("test");
        child.setParent(parent);
        String prop = "parent.name";
        boolean goon = true;
        Object aObject = child;
        while (goon) {
            int indexOf = prop.indexOf(".");
            String nextprop = null;
            if (indexOf < 0) {
                goon = false;
                nextprop = prop;
            } else {
                nextprop = prop.substring(0, indexOf);
                prop = prop.substring(indexOf + 1);
            }
aObject = FacesContext.getCurrentInstance().getApplication() .getPropertyResolver().getValue(aObject, nextprop);
        }
String aString = (String) aObject;

aString.equals("test") == true!

It would just be nice if there was an existing method which is already doing the while loop, like:

String aString = (String) ...resolveEverything().getValue(child, prop);

Regards
René

On Mon, 13 Nov 2006 17:58:00 +0100
 "Martin Marinschek" <[EMAIL PROTECTED]> wrote:
Hi Rene,

what do you mean by "in a non JSF context"? If you mean in your
managed beans, you can do:

FacesContext.getCurrentInstance().getApplication().getVariableResolver().resolveVariable(FacesContext.getCurrentInstance(),"exprString");

If you mean general expression resolving, you might want to use the
commons-el package directly.

regards,

Martin

On 11/13/06, Rene Guenther <[EMAIL PROTECTED]> wrote:
Hello,

I would like to make use of JSF EL in a non JSF context. I
d like to do something like:

String name = (String) EVALUATE(child,
"child.parent.name") instead of
String name = child.getParent().getName();

Probably there is somewhere the EVALUATE method I am
looking for. Anyone knows where?

Thanks
René



--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to