myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Stracuzzi <fabiostracu...@gmail.com>
Subject Re: How do I initialize this property within the faces-config file?
Date Tue, 06 Oct 2009 14:22:07 GMT
Hi Dave,

You can initialize bean properties, so:

<managed-bean>
     <managed-bean-name>emailController</managed-bean-name>

<managed-bean-class>myco.util.jsf.controller.EmailController</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>

     <managed-property>
            <property-name>stringField</property-name>
            <value>stringOrELexpression</value>
     </managed-property>

     <managed-property>
            <property-name>listField</property-name>
            <list-entries>
                    <value-class>java.lang.String</value-class>
                    <value>Web Servers for Fun and Profit</value>
                    <value>#{myBooks.bookId[3]}</value>
                    <null-value/>
            </list-entries>
     </managed-property>

     <managed-property>
            <property-name>prices</property-name>
            <map-entries>
                    <map-entry>
                          <key>My Early Years: Growing Up on *7</key>
                          <value>30.75</value>
                   </map-entry>
                   <map-entry>
                          <key>Web Servers for Fun and Profit</key>
                          <value>40.75</value>
                   </map-entry>
            </map-entries>
    </managed-property>

 </managed-bean>

You can set list (or array), Map or bean attribute. You can set also null
value [ <null-value/> ]
You can also use EL Expression

Bye
Fabio


2009/10/6 laredotornado <laredotornado@gmail.com>

>
> Hi,
>
> I'm using Resin 3.0.19 with MyFaces 1.1.5.  I have this managed bean in my
> faces config file ...
>
>  <managed-bean>
>    <managed-bean-name>emailController</managed-bean-name>
>
>
> <managed-bean-class>myco.util.jsf.controller.EmailController</managed-bean-class>
>    <managed-bean-scope>session</managed-bean-scope>
>  </managed-bean>
>
> Within this managed-bean emailController, I have a member field, "fields",
> which is a Map<String, String>.  I would like to initialize the map
> property, "Renew" to "true" when the managed bean is initialized.  How can
> this be done in the faces-config.xml file?
>
> Thanks, - Dave
> --
> View this message in context:
> http://www.nabble.com/How-do-I-initialize-this-property-within-the-faces-config-file--tp25769023p25769023.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message