2016-04-14 19 views
0

KomutLink'e tıkladıktan sonra bileşen paneli grubunu güncellemeyi deniyorum, ancak başarılı değil. Zaten birçok yolu denedim ama hiçbir şey yardımcı olmuyor. Lütfen, söyle bana, panel grubunu güncellemek için ne yapmalıyım?Neden tıklandıktan sonra panel grubu güncellenmiyor?

<h:commandLink value="View" update="workplace"> 

Sana farz ediyorum:

<h:panelGroup layout="block" id="content"> 
    <h:panelGroup layout="block" id="nav"> 
     <h:form id="itemsMenu"> 
      <h:commandLink value="View" update="workplace" actionListener="#{main.determineAction}"> 
       <f:param name="link" value="Viewing telephone book"/> 
      </h:commandLink> 
     </h:form> 
    </h:panelGroup> 
    <h:panelGroup id="workplace"> 
     <h:panelGroup layout="block" rendered="#{main.responseRendered}"> 
      <ui:include src="#{main.linkPage}"/> 
     </h:panelGroup> 
    </h:panelGroup> 
</h:panelGroup> 

Bean kod: burada bir hata atmalıydım böylece

@ManagedBean(name = "main") 
@ViewScoped public class MainBean implements Serializable { 

private static final long serialVersionUID = 1L; 
private List<String>  listItemsMenu; 
private String   linkPage; 
private boolean   responseRendered = false; 

public boolean isResponseRendered() { 
    return responseRendered; 
} 

public void setResponseRendered(final boolean responseRendered) { 
    this.responseRendered = responseRendered; 
} 

public String getLinkPage() { 
    return linkPage; 
} 

public void setLinkPage(final String linkPage) { 
    this.linkPage = linkPage; 
} 

public void determineAction(final ActionEvent event) { 
    final Locale currentLocale = SessionBean.getCurrentLocale(); 
    final MessageManager messageManager = new MessageManager(currentLocale); 
    final Map<String, String> mapParameters = FacesContext.getCurrentInstance() 
     .getExternalContext().getRequestParameterMap(); 
    final String linkType = mapParameters.get(Constants.ATTRIBUTE_LINK_TYPE); 
    if (linkType.equals(messageManager.getProperty(Constants.MESSAGE_MENU_VIEWING))) { 
    linkPage = Constants.PAGE_VIEW; 
    } 
    ... 
    responseRendered = true; 
    } 
} 

cevap

0

Ok iyi komut bağlantı, öznitelik güncelleştirme yok bir ajax çözümü istersiniz:

<h:commandLink value="View"> 
       <f:param name="link" value="Viewing telephone book"/> 
<f:ajax render="workplace" listener="#{main.determineAction}" /> 
      </h:commandLink> 
İlgili konular