0 Replies Latest reply on May 6, 2010 3:24 AM by shasho

    Implementing a page that supports both Ajax and URL parameters.

    shasho

      We have some conceptual problem implementing a page that supports both Ajax and URL parameters. I was wondering if someone could point to the right way of doing it.
      We implementer the bean as long conversation (to support Ajax) and in the @Create method collect the URL parameters




      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("articlePage")
      public class ArticlePageAction implements ArticlePage
      {….
      @RequestParameter
           Long articleID;
      ….
           @Create
           @Begin
           public void initPage() 
           {
                currentArticleID = articleID
      



      Here we collect URL and initialize our current article (currentArticleID)


      Since the user can do numerous Ajax operation we don’t know when to end this long running conversation ….We can tell when the user leave the page if it redirect to other page
      Here we have two alternatives


      1. Wait in the getter of currentArticleID and if  articleID!= currentArticleID update currentArticleID without ending the old conversation (or should we end it ?)


      2. In the redirect end the old conversation and start a new one using




      <s:link value="another" view="/general/article.xhtml">
      <f:param name="articleID" value="#{articlePage.prevArticle.id}"/>
           <s:conversationPropagation type="end"/> 
      </s:link>




      Question


      1. How can we be sure that the ending of the last conversation happens before the start of the new one ? Looking at the debugger and prints it seems that it is not always the case…


      2. Can we support Ajax without long running conversations ? It seems that long running conversations was meant to do something else…