users@glassfish.java.net

Re: Glassfish and JSF (Mojarra) problems

From: Dominik Dorn <dominik.dorn_at_gmail.com>
Date: Wed, 2 Jun 2010 23:13:17 +0200

the problem is, that the EL #{headAndFoot.banners} will look for a
getter Map getBanners() on the bean headAndFoot which does not
exist as TreeMap does not have such a getter.
The same applies for the configuration through faces-config.xml

Make your life easy and create a Java Class

package com.app.yourApp;

public class HeadAndFoot{

private Map banners;

public Map getBanners()
{
return banners;
}

public void setBanners(Map b)
{ banners = b; }

}

and use that class instead of directly using java.util.TreeMap

like this

<managed-bean>
       <managed-bean-name>headAndFoot</managed-bean-name>
       <managed-bean-class>com.app.yourApp.HeadAndFoot</managed-bean-class>
       <managed-bean-scope>application</managed-bean-scope>
       <managed-property>
           <property-name>banners</property-name>
           <map-entries>
               <key-class>java.lang.String</key-class>
               <map-entry>
                   <key>headerUrl</key>
                   <value>http://foo.utah.edu</value>
               </map-entry>
               <map-entry>
                   <key>urlName</key>
                   <value>Request For Change</value>
               </map-entry>
           </map-entries>
       </managed-property>
   </managed-bean>
</faces-config>



-- 
Dominik Dorn
http://dominikdorn.com
Liquido Lyrics: http://www.lyrix.eu/lyrics/Liquido/