2012-04-20 3 views
0

PrimeFaces의 NotificationBar에 이상한 문제가 있습니다.PrimeFaces notificationBar를 추가하면 코드가 작동을 멈 춥니 다.

내 코드가 작동하지만 NotificationBar를 추가하면 이상한 행동을하게됩니다!

DataTable에서 Session Bean의 데이터를 표시하고 있습니다. 모든 게 잘하지만이 NotificationBar를 추가, 즉시, 데이터 테이블이 비어되고 어떤 내용이 가져온입니다 :

<!-- NOTIFICATION BAR headerMain.xhtml --> 
    <h:form> 
     <pou:poll autoStart="#{loginBean.logged}" global="false" interval="5" oncomplete="notificationBar.toggle()" update=":notificationBar"/> 
    </h:form> 


    <pou:notificationBar effect="slide" id="notificationBar" rendered="#{messagesBean.checkDaNotificare()}" widgetVar="notificationBar">        
     <h:outputLink value="./faces/messaggi.xhtml">           
      <h:outputText value="Hai 1 messaggio da leggere" rendered="#{messagesBean.daNotificare==1}"/> 
      <h:outputText value="Hai #{messagesBean.daNotificare} messaggi da leggere" rendered="#{messagesBean.daNotificare > 1}"/> 
     </h:outputLink> 
    </pou:notificationBar> 

_

<!-- DATATABLE IN messaggi.xhtml --> 
<pou:dataTable editable="false" id="conversationList" resizableColumns="false" rowKey="#{conversazione}" selection="#{messagesBean.destinatario}" selectionMode="single" value="#{messagesBean.listaConversazioni}" var="conversazione" widgetVar="conversationList" paginator="true" paginatorPosition="bottom" rows="20"> 
         <pou:ajax event="rowSelect" oncomplete="conversationDialog.show()" update=":conversationDialog, :menuPanel"/> 
         <pou:column> 
          <f:facet name="header"> 
           <div style="padding-left: 45%"> 
            <h:outputText value="Conversazioni"/>                                
            <h:form> 
             <pou:commandButton value="+" onclick="newMessageDialog.show()" style="margin-left: 67%"/> 
            </h:form> 
           </div> 
          </f:facet> 
          <h:outputText value="#{conversazione.username}"/> 
         </pou:column> 
        </pou:dataTable> 

_

: 여기에/

는 일부 코드입니다

//Method used by NotificationBar to see if it has to be rendered 
public boolean checkDaNotificare() { 
    System.err.println(daNotificare); 
    daNotificare = 0; //Riazzero, quelli precedenti li avrò già notificati 
    for (Messaggio m : getMessaggiDaLeggere()) { 
     System.err.println("Controllo " + m); 
     if (!messaggiNotificati.contains(m)) { //Conto i messaggi da notificare, che sono quelli da leggere meno quelli già notificati 
      System.err.println("___Non l'avevo ancora notificato!"); 
      daNotificare++; 
      messaggiNotificati.add(m); 
     } 
    } 
    return (daNotificare > 0); 
} 

_

//Method used by the datatable to fetch data 
public List<Utente> getListaConversazioni() { 
    listaConversazioni = messageManager.getUtentiConversazioni(utente); 
    return listaConversazioni; 
} 

/** 
* PostConstruct method to initialize things 
*/ 
@PostConstruct 
public void init() { 
    listaConversazioni = messageManager.getUtentiConversazioni(utente); 
    messaggiNotificati = new LinkedList<>(); 
} 

"특별한"작업을 수행하지 않아 매우 간단하기 때문에 코드를 이탈리아어로 남겼습니다.

내가 뭘 잘못하고 있니? 나는 미리 :(

감사를 succeding 않고 제외한 거의 모든 시도했습니다

편집 :! 내가 다른 페이지로 notificationBar의 코드를 이동 시도하고 모든 작품 이 ... 상황이 매우 이상한지고/

+0

단지 추측, 아마도 ./faces/messaggi에 대한 상대적 경로와 관련이 있습니다. .xhtml "? 다른 페이지에서는 괜찮지 만 첫 번째 페이지에서는 그렇지 않습니다. – Daniel

+0

아니오, 그저 링크 일뿐입니다. 문제는 무엇인지 파악할 수 없지만 비어있는 NotificationBar로도 알 수 있습니다. – StepTNT

+0

안녕하세요.이 문제를 해결 했습니까? 난 비슷한 행동을 가지고 .... thnx – Mariah

답변

0

StepTNT ... 난 당신이 데이터 테이블에 filteredValue를 지정해야합니다 생각합니다. 보통은 filteredValue의 새로운 ArrayList를() 인스턴스를 설정하지만 최근에 나는이 문제에 직면하고 인스턴스없이 filteredValue으로 날 위해 일했습니다.

+0

안녕 어둠, 스택 오버플로, 최고의 답변뿐만 아니라 그 코드가 문제를 해결하는 방법에 대한 설명뿐만 아니라 코드가 포함되어 있습니다. 그보다 작은 것들과 게시물은 잡음 일 수 있습니다. 이 게시물을 개선하기 위해 [편집]을 고려하십시오. 행운을 빕니다! :) – jmort253

관련 문제