Hello I want to select an object from a Datatable via the DataModel and the DataModelSelectionIndex like in the booking example.
I always get an Exception :
....attempted to bind an Out attribute of the wrong type to: contributable...
My Class looks like this
@Stateful @Name("findContributables") @Interceptor(SeamInterceptor.class) public class FindContributablesAction implements FindContributables, Serializable { private static final long serialVersionUID = -6803933802941651662L; @PersistenceContext(type=EXTENDED) private EntityManager em; @DataModel private List<Object> contributables; @DataModelSelectionIndex private int contributableIndex; @Out private Object contributable; ....
public String selectContributable() { if (contributables==null) return "contributableList"; try{ setContributable(); }catch(Exception e){System.out.println(e+"@selectContributable");} System.out.println("Contributable was selected @setContributable"); return "contributableSelected"; } private void setContributable(){ try{ contributable = contributables.get(contributableIndex); }catch(Exception e){System.out.println(e.toString()+"@setContributable");} System.out.println("Contributable #"+contributableIndex+" was set @setContributable" +contributable.toString()); }
public List<Object> getAllContributables() { String[] types = {"Journal", "Book", "Workshop", "Conference"}; List<Object> list = null; try { ContributableManager cm = new ContributableManagerBean(em); for (int i=0; i<types.length; i++) { List<Object> templist = cm.findContributable(types, null); if (list == null) { list = templist; } else { list.addAll(templist); } } } catch (Exception e) { } contributables = list; return list; }