5 Replies Latest reply on Jun 24, 2008 4:56 AM by ilya_shaikovsky

    question about a4j:region

    ziphyre

      Hi,

      I'm using richfaces with seam (2.0.2) and I think I'm missing some point.
      I got a a4j:commandLink seperated with his own form (and not nested in any other form) linked to a simple method who actually just change a string property, it has no reRender, nor action attribute:

      <h:form>
       <a4j:region>
       <a4j:commandLink styleClass="tabHead life" value="Hot Spot"
       actionListener="#{panelManager.switchLeftPanelVisibility}"
       onclick="$('buddiesPanel').hide();$('lifePanel').show();"/>
       </a4j:region>
      </h:form>


      But every time I click the link, I see all the database interaction log that would occur on a page reload on my eclipse console...

      16:44:23,236 INFO [STDOUT] Hibernate:
       select
       message0_.id as id48_,
       message0_.messageRead as messageR2_48_,
       message0_.messageText as messageT3_48_,
       message0_.subject as subject48_,
       message0_.fromUser as fromUser48_,
       message0_.conversationId as conversa5_48_,
       message0_.toUser as toUser48_,
       message0_.sentDate as sentDate48_,
       message0_.replyTo as replyTo48_
       from
       Message message0_
       where
       message0_.toUser=?
       order by
       message0_.sentDate DESC
      
      ...... etc etc.

      Since this request has nothing to do with db, is in his own form, and seperated with a4j:region, I would except no db interaction at all, but obviously I didn't quite get the inner workings of a ajax request. So I would be very happy if you could explain me what's going on...

      Thanks...


      PS: since a4j:commandLink is the only element in that specific form, a4j:region is unnecessary, isn't it?

        • 1. Re: question about a4j:region
          ilya_shaikovsky

          please show full page content.

          • 2. Re: question about a4j:region
            ziphyre

            It's very crowded, I'll try to simplify without breaking the structure...

            <div id="leftColumn" class="Column"><!-- leftColumn -->
             <h:form>
             <a4j:region>
             <a4j:commandLink styleClass="tabHead life" value="Hot Spot"
             actionListener="#{panelManager.switchLeftPanelVisibility}"
             onclick="$('buddiesPanel').hide();$('lifePanel').show();"/>
             <a4j:commandLink styleClass="tabHead buddy" value="People"
             actionListener="#{panelManager.switchLeftPanelVisibility}"
             onclick="$('lifePanel').hide();$('buddiesPanel').show();"/>
             </a4j:region>
             </h:form>
            
             <a4j:outputPanel id="lifePanel" layout="block" style="display:#{panelManager.hotspotDisplay}">
             <div id="lifePanelContainer">
             <h:form id="hotspotForm">
             <h1 id="lOne" class="accordion_toggle first mail">Mesaj Kutum</h1>
             <a4j:outputPanel layout="block" id="mailList" styleClass="accordion_content mail">
             <rich:datascroller styleClass="scroller" id="latestMessageScroller"
             for="messages" pageIndexVar="pageIndex" pagesVar="pages">
             ...
             </rich:datascroller>
             <rich:dataTable id="messages" var="msg" value="#{messageList}" rows="2">
             <rich:column>
             <img src="#{msg.from.imagePath}" alt="" />
             <h4>#{msg.from.firstName} #{msg.from.lastName}</h4>
             <a4j:commandLink styleClass="#{msg.read?'read':''}"
             action="#{quickMessages.select}"
             value="#{empty msg.subject ? '...' : msg.subject}" />
             ...
            
             <div class="clear dotted"> </div>
             </rich:column>
             </rich:dataTable>
             </a4j:outputPanel>
            
             <h1 id="lTwo" class="accordion_toggle request">Pending Requests </h1>
             <a4j:outputPanel layout="block" id="pendingRequests"
             styleClass="accordion_content request">
             <rich:datascroller styleClass="scroller" id="pendingRequestScroller"
             for="request" pageIndexVar="pageIndex" pagesVar="pages">
             ...
             </rich:datascroller>
             <rich:dataTable id="request" var="req" value="#{friendRequestList}" rows="2">
             <rich:column>
             <h4>#{msg.from.firstName} #{msg.from.lastName}</h4>
             <img src="#{req.from.imagePath}" alt="#{friend.firstName} #{friend.lastName}" />
             <a4j:commandLink styleClass="connect" action="#{friendRequestManager.accept}"
             value="Kabul Et" reRender="pendingRequests" />
             <a4j:commandLink styleClass="reject" action="#{friendRequestManager.reject}"
             value="Reddet" reRender="pendingRequests" />
             </rich:column>
             </rich:dataTable>
             </a4j:outputPanel>
             </a4j:outputPanel>
             </h:form>
             </div>
             </a4j:outputPanel>
            </div><!-- /leftColumn -->


            • 3. Re: question about a4j:region
              lucianobrunes

              Hi,

              I know that this post is a long time, but the needs remain.

              succeeded or someone suggests solution to this problem that persists?

              • 4. Re: question about a4j:region
                ziphyre

                nope, the question still remains on my part. I just switched to other parts of the development and left the optimization to a later period...

                • 5. Re: question about a4j:region
                  ilya_shaikovsky