4 Replies Latest reply on Mar 23, 2006 7:41 PM by zzztimbo

    creating a page with lists from the db

    zzztimbo

      i would like to have a page display items that are already persisted in the database.

      the examples i've encountered have been displaying a list of items only after an action button has been pressed. is there an example of how to do this when a page loads?

        • 1. Re: creating a page with lists from the db
          ido_tamir

          from the docs:
          1.3.2. How it works
          The first time we navigate to the messages.jsp page, whether by a JSF postback (faces request) or a direct browser GET request (non-faces request), the page will try to resolve the messages context variable. Since this context variable is not initialized, Seam will call the factory method findMessages(), which performs a query against the database and results in a DataModel being outjected. This DataModel provides the row data needed for rendering the <h:dataTable>.

          hth
          ido

          • 2. Re: creating a page with lists from the db
            zzztimbo

             

            "ido_tamir" wrote:
            from the docs:
            1.3.2. How it works
            The first time we navigate to the messages.jsp page, whether by a JSF postback (faces request) or a direct browser GET request (non-faces request), the page will try to resolve the messages context variable. Since this context variable is not initialized, Seam will call the factory method findMessages(), which performs a query against the database and results in a DataModel being outjected. This DataModel provides the row data needed for rendering the <h:dataTable>.

            hth
            ido


            ok. i added a @Factory annotation to my method that is equivalent to findMessages(). now i get this error: "In attribute requires value for component:" what does this mean? how do i attempt to fix this?





            • 3. Re: creating a page with lists from the db
              gavin.king

              It means there is an @In attribute for a context variable that is null, and you do not have required=false or create=true.

              • 4. Re: creating a page with lists from the db
                zzztimbo

                 

                "gavin.king@jboss.com" wrote:
                It means there is an @In attribute for a context variable that is null, and you do not have required=false or create=true.


                thank you very much. that appears to have worked.