0 Replies Latest reply on Nov 4, 2005 2:05 PM by andrew.rw.robinson

    Seam and the OnLoad JSF issue

    andrew.rw.robinson

      I am wondering if seam has a way to solve the problem with the lack of an OnLoad function. This problem also goes along with a related question of the ifNotBegin functionality of a conversation.

      Here is an example use case:
      Admin user goes to URL for administering users
      The admin page shows a list of current users
      Admin user selects a user to update or delete or create a new user which is the start of the logical transaction/conversation.

      First issue:
      When the page is loaded, the collection of current users needs to be loaded. I was thinking the "@Create" would satisfy this need, so that when the Page first accesses the bean's user list, the list will be loaded.

      Question:
      If the @Create method throws an exception, how will Seam handle that? I would be nice to support a return value of String from the Create method, that when not null, causes the NavigationHandler to be used to navigate to a new page with that result.

      Second question/issue:
      The user bookmarks editUser.jsf which is the page that is loaded when the user chooses to edit one of the current users. The conversation would not have started at that point, but the editUser.jsf page does not call a method, but just refers to the user object, which is null. When does the ifNotBegin kick in? Can it cause the result to be handled when the page is loaded?

      I would to have the editUser.jsf page kick back to listUsers.jsf when the user tries to load the editUser.jsf page from the URL (bookmarked page for example)

      The booking example doesn't address these issues. If I navigate to "http://seam.demo.jboss.com/hotel.jsf", the hotel page loads with no attributes. Only when I click a button, does it kick me back to the find hotels page. This is too late for a good user experience. Also, the booking example, doesn't auto-load the hotels, but I have to search first, so it avoids my first question.

      Is there a good way to use Seam to address these on page load issues?

      Thanks,
      Andrew