EL is returned by backing bean, but page does not recognize it as an EL

#applicationResources.properties
test. Name = name

on the page
< af:intputText value = "#{bean.testName}" >

bean
{Bean #getTestName ()}
Return '#{msg['test.name']}";// msg is packaged in faces-config. XML
}


what the rendered page is to not translate this EL, but the direct output as string ' #{msg ['test.name']}. "

How could I accomplish this, to get the string "Name" to "test.name"?

Thank you.

Kevin.

Published by: kevin.feng on May 20, 2009 22:07

You may not use EL expressions directly in your Java bean code, you must use something like the following in your backing bean:

String myValue = (String)FacesContext.getCurrentInstance().getApplication().createValueBinding("#{msg}");

.. .the support in the example above, it's the expression returns a string, so the cast. If you can not get this to work, try to set it to:

String myValue = (String)FacesContext.getCurrentInstance().getApplication().createValueBinding("#{'fish'}");

.. .checking in the debugger that myValue decides to 'fish '. This will tell you that the resolver EL is working correctly, but there is something wrong with access of the words EL 'msg '.

See you soon,.

CM.

Tags: Java

Similar Questions

Maybe you are looking for