4 Replies Latest reply on Mar 31, 2008 8:08 PM by Tim Morgan

    Property not found

    Tim Morgan Newbie

      Hi!
      I have this session bean:



      @Stateless
      @Name("pictureManager")
      public class PictureManagerAction implements PictureManager {
      
           private List<PictureRight> pictureRightList;
           
           private void initPictureRightList() {
                  log.info("initPictureRightList()");
                  Query query = em.createQuery("select p from PictureRight p order by name");
                pictureRightList =  query.getResultList();
                  log.info("Number of rights: " + pictureRightList.size());
           }
      
           public String editPicture() {
                initPictureRightList();
                if (selectedPicture != null) {
                     return "edit";
                } else {
                     return null;
                }
           }
      
           public List<PictureRight> getPictureRightList() {
                log.info("getter called");
                return pictureRightList;
           }



      If I press a button in my application editPicture() and initPictureRightList() is invoked which I can see in the log.


      I get the Hibernate output of the database query and the log message shows how many items are returned from the database.
      I have to assume that the member pictureRightList is not null.


      My following view tries to render this data in a select box but I only get a PropertyNotFoundException.


      The relevant part of the view:


      <h:selectManyListbox size="10" value="#{pictureManager.selectedPicture.pictureRightList}">
           <s:selectItems value="#{pictureManager.pictureRightList}"
           var="pictureRight" label="#{pictureRight.name}" />
           <s:convertEntity />
      </h:selectManyListbox>



      I don't know where the problem is because it looks pretty similar to the Hello World example (avoiding bijection) from the Yuan-book.


      I tried #{pictureRightList} directly and I don't get the exception but the value is null. (I don't know how the variable is transported at all because there is no @Out or is there a implicit outjection?)


      What do I have to do to get the data from the pictureRightList  and display it with or without outjection?


      Thanks!