-
15. Re: how to use s:selectItems with h:selectManyCheckbox
danielc.roth Mar 11, 2008 10:25 AM (in response to anatorian)Tss... who uses IE7? ;-)
Thank's for the correction though...
-
16. Re: how to use s:selectItems with h:selectManyCheckbox
nickarls Mar 11, 2008 10:26 AM (in response to anatorian)how does it react to dropping the convertEntity and using
<s:selectItems value="#{roleList.resultList}" var=role label="#{role.name}" itemValue="#{role.id}" />
BTW, shouldn't it be value="#{...}". Or do the quotes matter?
-
17. Re: how to use s:selectItems with h:selectManyCheckbox
nickarls Mar 11, 2008 10:32 AM (in response to anatorian)
Daniel Roth wrote on Mar 11, 2008 10:25 AM:
Tss... who uses IE7? ;-)
54% of the known world and 5.4% of the nerds. I must confess that I do, mostly since that is what our customers mostly have standardized on and I don't feel like running two browsers all the time.
I haven't bothered to file a JIRA that e.g the tag box renders weird on IE8 beta :-).
-
18. Re: how to use s:selectItems with h:selectManyCheckbox
anatorian Mar 11, 2008 10:36 AM (in response to anatorian)The xhtml: <h:selectManyCheckbox value=#{userHome.instance.roles}> <s:selectItems value=#{roleList.resultList} var=role label=#{role.name} itemValue="#{role.id}" /> </h:selectManyCheckbox> Error msg: Cannot convert 2 of type class java.lang.Long to class com.liba.link.security.entity.Role stack trace: java.lang.IllegalArgumentException: Cannot convert 2 of type class java.lang.Long to class com.liba.link.security.entity.Role at org.jboss.el.lang.ELSupport.coerceToType(ELSupport.java:358) at org.jboss.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:46) at org.jboss.seam.el.SeamExpressionFactory.coerceToType(SeamExpressionFactory.java:70) at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption(SelectManyCheckboxListRenderer.java:275) at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:146)
-
19. Re: how to use s:selectItems with h:selectManyCheckbox
damianharvey.damianharvey.gmail.com Mar 11, 2008 10:37 AM (in response to anatorian)I've had problems with selectManyCheckBox and s:selectItems. Are you getting an error messages that says something like
Cannot coerce to type
?If so change your mapping to EAGER. The original forum post was this one
Hope this helps.
Cheers,
Damian.
-
20. Re: how to use s:selectItems with h:selectManyCheckbox
pmuir Mar 11, 2008 12:13 PM (in response to anatorian)You can't back a JSF <h:selectXXX /> with a Set - it must be a List or an array.
-
21. Re: how to use s:selectItems with h:selectManyCheckbox
anatorian Mar 12, 2008 9:39 AM (in response to anatorian)Yes, you are right! I use List instead of Set, and it works! Great!
-
22. Re: how to use s:selectItems with h:selectManyCheckbox
damianharvey.damianharvey.gmail.com Mar 12, 2008 10:05 AM (in response to anatorian)Even with a List you may still get intermittent coerceToType errors unless you set your mapping to EAGER. Ironically this reoccurred in my application yesterday after not seeing it for about 5 months.
Cheers,
Damian.
-
23. Re: how to use s:selectItems with h:selectManyCheckbox
damianharvey.damianharvey.gmail.com Mar 14, 2008 6:21 PM (in response to anatorian)Note that the coerceToType error is now fixed with the latest JSF libs (1.2_08) : JIRA
Cheers,
Damian.
-
24. Re: how to use s:selectItems with h:selectManyCheckbox
pmuir Mar 14, 2008 7:30 PM (in response to anatorian)Stan wrote up some quick instructions on upgrading your version of JSF to 1.2.08 - http://wiki.jboss.org/wiki/Wiki.jsp?page=UpgradeToMojarra1_2_08
-
25. Re: how to use s:selectItems with h:selectManyCheckbox
damianharvey.damianharvey.gmail.com Mar 15, 2008 6:10 PM (in response to anatorian)There are some little differences in how JSF 1.2_08 renders the page. For instance it seems a bit tighter on passing through 'illegal' (or just immoral?) attributes.
For instance
border
in h:graphicImage. It used to pass it through even though it's not actually a 'proper' attribute. Now it doesn't. No big deal but worth being aware of.Cheers,
Damian.
-
26. Re: how to use s:selectItems with h:selectManyCheckbox
anatorian Mar 17, 2008 3:18 AM (in response to anatorian)Where can I download the jboss AS 5 CR1? The latest release in the download page is jboss AS 5 beta 4.
Thanks
-
27. Re: how to use s:selectItems with h:selectManyCheckbox
pmuir Mar 17, 2008 4:20 PM (in response to anatorian)Not yet released
-
28. Re: how to use s:selectItems with h:selectManyCheckbox
mars1412 Mar 17, 2008 5:40 PM (in response to anatorian) -
29. Re: how to use s:selectItems with h:selectManyCheckbox
irace Mar 19, 2008 4:27 PM (in response to anatorian)Hi,
I post my own question here, because it seems to me that it's the same kind of problem. I'm using Seam 2.0.0 within JBoss 4.2.2. I'm trying to set values for a many2many relationship using selectManyCheckbox component, and keep having a conversion error when doing so (via a JSF message).
As a side note, I'm using a managed Hibernate session, and cannot / do not want to switch to an EJB entity manager.
Here is the component declaration (xhtml):
<h:selectManyCheckbox id="roles" value="{user.roles}"> <s:selectItems value="{roleList}" var="role" label="#{role.rolename}" /> </h:selectManyCheckbox>
Here is the backing bean (having DbEntity implementing equals() and hashcode(), of course):
@Entity @Name("user") @Scope(SESSION) public class User extends DbEntity { private Set<Role> _roles; (...) /** * @hibernate.many-to-many * column="ROLE_FK" * class="Role" * @hibernate.key * column="UTILISATEUR_FK" * not-null="true" * @hibernate.set * cascade="save-update" * access="property" * table="ROLE_UTILISATEUR" * lazy="false" */ public Set<Role> getRoles() { return _roles; } /** */ protected void setRoles(Set<Role> roles) { _roles = roles; } }
At rendering time, all is ok : my checkboxes appear with adequate values selected. But when I try to save the user (having modified anything or not), I've got the following message: Conversion Error setting value '...' for '{user.roles}'
I've tried the following:
1. using s:convertEntity with my hibernate session, but the EntityConverter is not initialized, because it has no session attribute (as I understood it, it is designed to work with EJB entity manager only)
2. define my own converter implementing javax.faces.convert.Converter for the Role entity. The getAsString method was called ok, but getAsObject was never called. I think I configured it ok in selectManyCheckbox, but maybe I made some mistake.
Nothing seems to work. Could anybody help me or give me some advice on this subject ?
Thanks
Thom'