13 Replies Latest reply on Nov 20, 2008 3:43 PM by ivan senji

    selectitems: java.lang.IllegalArgumentException: Id and clazz must not be null

    Henrik Midell Newbie

      I'm quite a beginner in seam, with the following problem.


      I have a jsf page showing a list of selectmanylistbox. The items are rss-articles received from a number of rss sources.
      My wish is to let the user select some of these articles, and then they should be saved to the database.
      The problem is that I have not yet persisted all the articles before showing them in the page, why I get the IllegalArgumentException, since the id is null.
      Do I have to persist all the articles before handling them in the jsf page?


      Here are my code:


      rss.xhtml:


      <h:selectManyListbox id="articles" value="#{articleController.selectedArticles}" rendered="#{articleController.selectedRssSources != null}" size="10" style="width:300px;">
                               <f:selectItems value="#{articleController.rssArticles}"/>
                               <s:convertEntity/>
                          </h:selectManyListbox>




      controller/bean:


      public List<SelectItem> getRssArticles() throws BusinessException {
           List<SelectItem> allArticles = new ArrayList<SelectItem>();
              for(RssSource rssSource : selectedRssSources) {
                  logger.debug("Selected rsssource: " + rssSource.getRssName() + ", id: " + rssSource.getId());
                  List<Article> articleList = articleService.getNewArticles(rssSource);
                  allArticles.addAll(mapArticleToSelectItem(articleList));
              }
              return allArticles;
          }