webtier@glassfish.java.net

JSF 2 Custom Component el on attribute

From: <webtier_at_javadesktop.org>
Date: Thu, 08 Apr 2010 07:36:16 PDT

Hi!,
I'v created a custom component which has an attribute called displayname.
On my facelet when setting displayname with an el expression ( that takes a value from a resource bundle), displayname is not set.
When I just set displayname with a normal string it gets set.

Why can't I use el in this fashion?
If I use a binding should the type of display name be ValueBinding or something?

In my xhtml page I use my component like this :

<vplf:menuGroup displayname="#{msg['menu.examples']}"> // doesn't set display name


<vplf:menuGroup displayname="menu.examples"> // sets display name with string menu.examples


Code snippets :
Custom component :
public class MenuGroup extends UIComponentBase {

    protected String href;
    protected String displayname;
    protected String cssClass;
    protected String policy;

    public String getDisplayname() {
        return displayname;
    }

    public void setDisplayname(String displayname) {
        this.displayname = displayname;
    }
    
    @Override
    public abstract String getRendererType();

Faces config :
<application>
    <resource-bundle>
      <base-name>vplf.configuration.MessageResources</base-name>
      <var>msg</var>
    </resource-bundle>
    <locale-config>
      <default-locale>en</default-locale>
      <supported-locale>en</supported-locale>
      <supported-locale>se</supported-locale>
    </locale-config>
  </application>
[Message sent by forum member 'stephendw']

http://forums.java.net/jive/thread.jspa?messageID=395928