1 Reply Latest reply on Aug 19, 2008 11:47 AM by Mikael Andersson

    Problems with values refreshing.

    daniel jarrett Newbie

      I've only just started messing about with seam and I'm still trying to get my head around how it operates. I've basically been making changes to a crud app i generated with eclipse.

      I've got the following bit of code which is a select list with a bunch of articles in it and a data table which displays all results of related articles to a page (yes i'm trying to build an admin front end for my cms).

      The problem I'm having is that the data table doesn't update after I've added values to the page via the select list. Is there anything i can/should be doing to make pageRelatedArticleList.getPageRelatedArticles(pageHome.instance.pageId)
      get executed so the list can be updated?

          <rich:tab label="related articles">
           <h:form id="addArticle" styleClass="edit">
                  <f:facet name="header">Add Faq Item</f:facet>
                  <s:decorate id="articleDecoration" template="layout/edit.xhtml">
                      <ui:define name="label">article</ui:define>
                               <h:selectOneMenu value="#{pageRelatedArticleHome.instance.article}">
                                          <f:selectItems value="#{pageHome.relatedArticles}" />
                                         <s:convertEntity />
                <div style="clear:both">
                      <span class="required">*</span> 
                      required fields
              <div class="actionButtons">
                  <h:commandButton id="save" 
                  <rich:dataTable value="#{pageRelatedArticleList.getPageRelatedArticles(pageHome.instance.pageId)}" 
                            rendered="#{not empty pageHome.pageRelatedArticles}" 
                          <f:facet name="header">ID</f:facet>
                          <h:outputText value="#{pageRelatedArticle.pageRelatedArticleId}"/>
                          <f:facet name="header">articleId</f:facet>
                          <h:outputText value="#{pageRelatedArticle.article.articleId}"/>
                          <f:facet name="header">title</f:facet>
                          <h:outputText value="#{pageRelatedArticle.article.title}"/>
                          <f:facet name="header">action</f:facet>
                  <s:link view="/#{empty from ? 'PageRelatedArticle' : from}.xhtml" 
                      <f:param name="pageRelatedArticlePageRelatedArticleId" 
                  </s:link>    </h:column>

        • 1. Re: Problems with values refreshing.
          Mikael Andersson Master

          Try debugging the getter and if it gets called and what the parameter is.

          Is pageRelatedArticleList.getPageRelatedArticles calling the database? If it is you might want to consider a little re-design because that getter might get called several times during a request.

          Also the rendered checks pageHome.pageRelatedArticles, is pageRelatedArticlesList outjected from page home for useage by the value attribute?
          What if you don't use the outjected object does that work (get it via pageHome instead)?

          It is a bit difficult to try and figure out how the different classes interact, if you can't figure out why it doesn't work post the java code and it will be easier to help out.