You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by DFenS <df...@yahoo.com> on 2006/06/07 08:50:00 UTC
managed-bean presets for String[]
I have an ArrayList for a selectManyCheckbox component which is mapped to a
String array. I want to have a item of the checkbox to be selected by
default. I tried the following "not working" part with java.lang.String[]
and got a cast exception. How do I do this???
<managed-bean>
<managed-bean-name>licenseKeyBean</managed-bean-name>
<managed-bean-class>LicenseKeyBeanImpl</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<!-- not working -->
<!--managed-property>
<property-name>features</property-name>
<property-class>java.lang.String[]</property-class>
<list-entries>
<value-class>java.lang.String</value-class>
<value>1</value>
</list-entries>
</managed-property-->
<managed-property>
<property-name>featureList</property-name>
<property-class>java.util.ArrayList</property-class>
<list-entries>
<value-class>javax.faces.model.SelectItem</value-class>
<value>#{feature1}</value>
</list-entries>
</managed-property>
</managed-bean>
<!-- set features -->
<managed-bean>
<managed-bean-name>feature1</managed-bean-name>
<managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>label</property-name>
<value>dummy</value>
</managed-property>
<managed-property>
<property-name>value</property-name>
<value>1</value>
</managed-property>
</managed-bean>
--
View this message in context: http://www.nabble.com/managed-bean-presets-for-String---t1746093.html#a4746336
Sent from the MyFaces - Users forum at Nabble.com.
Re: managed-bean presets for String[]
Posted by DFenS <df...@yahoo.com>.
not working either ;-)
2006-06-08 09:56:33 ERROR -
org.apache.myfaces.shared_impl.util.ClassUtils:307 - Cannot coerce
java.util.ArrayList to [Ljava.lang.String;
javax.servlet.jsp.el.ELException: Attempt to coerce a value of type
"java.util.ArrayList" to type "[Ljava.lang.String;"
--
View this message in context: http://www.nabble.com/managed-bean-presets-for-String---t1746093.html#a4767844
Sent from the MyFaces - Users forum at Nabble.com.
Re: managed-bean presets for String[]
Posted by Matthias Wessendorf <ma...@apache.org>.
instead of "java.lang.String[]" can you try "[Ljava.lang.String;"
-Matthias
On 6/6/06, DFenS <df...@yahoo.com> wrote:
>
> I have an ArrayList for a selectManyCheckbox component which is mapped to a
> String array. I want to have a item of the checkbox to be selected by
> default. I tried the following "not working" part with java.lang.String[]
> and got a cast exception. How do I do this???
>
> <managed-bean>
> <managed-bean-name>licenseKeyBean</managed-bean-name>
> <managed-bean-class>LicenseKeyBeanImpl</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> <!-- not working -->
> <!--managed-property>
> <property-name>features</property-name>
> <property-class>java.lang.String[]</property-class>
> <list-entries>
> <value-class>java.lang.String</value-class>
> <value>1</value>
> </list-entries>
> </managed-property-->
> <managed-property>
> <property-name>featureList</property-name>
> <property-class>java.util.ArrayList</property-class>
> <list-entries>
> <value-class>javax.faces.model.SelectItem</value-class>
> <value>#{feature1}</value>
> </list-entries>
> </managed-property>
> </managed-bean>
>
> <!-- set features -->
> <managed-bean>
> <managed-bean-name>feature1</managed-bean-name>
>
> <managed-bean-class>javax.faces.model.SelectItem</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> <managed-property>
> <property-name>label</property-name>
> <value>dummy</value>
> </managed-property>
> <managed-property>
> <property-name>value</property-name>
> <value>1</value>
> </managed-property>
> </managed-bean>
>
> --
> View this message in context: http://www.nabble.com/managed-bean-presets-for-String---t1746093.html#a4746336
> Sent from the MyFaces - Users forum at Nabble.com.
>
>
--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com