java - JSF & Webflow - <h:selectManyListbox> converting troubles -


in jsf, have this:

<h:selectmanylistbox id="createaccountbasicinfo_select_types"  styleclass="selectmanycheckbox" value="#{party.roles}" size="6"  converter="persistenceobjecttostringtwowayconverter">       <f:selectitems value="#{acctypes.selectitems}" /> </h:selectmanylistbox> 

my converter:

 //[...]  import javax.faces.convert.converter;  //[...]  public class persistenceobjecttostringjsfconverter implements converter {     //[...]  public object getasobject(facescontext context, uicomponent component, string value) {     long id = long.valueof(value);     object object = null;     try {         object = getpersistenceservice(context).loadbyentityid(id); // here load appropriate record     } catch (coreexception e) {         e.printstacktrace();     } catch (elementcreationexception e) {         e.printstacktrace();     }     return object; //here need return arraylist of loaded objects instead of single object }  } 

in html, this:

<select id="form_party:createaccountbasicinfo_select_types"  name="form_party:createaccountbasicinfo_select_types" class="selectmanycheckbox"   multiple="multiple" size="6">    <option value="171128">andere</option>   <option value="171133">interessent</option>   <option value="171130">kunde</option>   <option value="171131">lieferant</option>   <option value="171134">mitarbeiter</option>   <option value="171132">mitbewerber</option>   <option value="171129">partner</option> </select> 

the value of each option id, have load database. arraylist of selected entries given webflow , saved database.

when press "save" button, selected items run through converter, need load items database (by value, ex. "171128") , add arraylist, inserted "party.roles" (check jsf code).

my problem: i'm getting following jsf exception:

/web-inf/page/core/fragments/account/accountbasicinfo.xhtml @152,58 value="#{party.roles}": property 'roles' not writable on type java.util.list

i think there problem converter. have change?

thank's anwsers!

(i'm using jsf 1.2)

the exception telling #{party} java.util.list in turn indeed doesn't have setroles() method #{party.roles} ain't going work.

the #{party} should managed bean , should have private list<role> roles property getter. converter should not return list<role> on getasobject() should return role.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -