2013-04-01 67 views
0

我是新手,但我的操作沒有被觸發。 在a4j中:commandLink id =「linklogout」我添加了一個不起作用的新動作menubean.resetMenuActionVariables。我可以在同一個文件中使用menubean,它可以工作。但是這個動作沒有被觸發。 我在論壇上搜索,我嘗試在commandlink上添加a4j:region或a4j:表格,但仍然無法使用。有任何想法嗎? 的代碼如下:action不會在a4j中觸發:commandlink

<div id="adminView_div" class="header"> 
    <a4j:outputPanel id="headerInfo"> 
     <h:form id="header_info"> 
      <h:panelGrid id="header_out1" columnClasses="left, right" columns="2" width="98%" >  
       <h:panelGrid id="header_pnl1" columns="1" width="98%" >    
        <h:graphicImage id="imglogo" value="../images/50.jpg" style="vertical-align: middle"/>  
       </h:panelGrid> 

       <h:panelGrid id="user_info_pnl1" columns="1" > 
        <h:panelGrid id="img_pnlGrid" cellpadding="0" cellspacing="0"> 
         <h:graphicImage id="notimg_img" value="../images/#{msgs.notimg}" 
          rendered="#{!sbean.forUse}" /> 
        </h:panelGrid> 
        <h:panelGrid id="user_info_pnl2" columns="1" > 
         <h:panelGroup id="about_userInfoPnlGroup"> 
          <h:outputText id="is_daysLeft" styleClass="warning-msg" value="#{instadminbean.daysLeft}"/> 
          <rich:spacer width="100"/> 
          <h:outputText id="welcomeMessage_lbl" value="#{msgs.welcomeMessage}!" style="font-size=13px; solid black; font-family:tahoma; margin-right:4px; text-align:right;"/> 
          <rich:spacer width="10"/> 
          <h:outputText id="is_aboutuserName" value="#{userAccount.userName}" styleClass="label-name" /> 
          <rich:spacer width="100"/> 
          <a4j:commandLink id="linklogout" value="#{msgs.logout}" 
          action="#{menubean.resetMenuActionVariables}" 
          onclick="javascript:window.location = '../reports/logout.html'; return false;" 
          rendered="true" style="margin-right:4px;color: #4F2170;"/> 
          <rich:spacer width="10"/> 
          <h:commandLink id="linkhelp" value="#{msgs.help}" rendered="true" onclick="window.open('pdf/#{msgs.homeguidename}#nameddest=About')" type="button" style="margin-right:4px;color: #4F2170;"/> 
         </h:panelGroup> 
        </h:panelGrid>  
       </h:panelGrid>   
      </h:panelGrid> 
     </h:form> 
    </a4j:outputPanel> 
</div> 

感謝,

多利安

回答

2

您的鏈接包含此:

onclick="javascript:window.location = '../reports/logout.html'; return false;" 

return false將防止從做任何回發到服務器的鏈接。你必須刪除這段代碼,它應該可以工作。

+0

它的工作原理。但是如果我想離開那裏「返回假」?這樣做還有其他方法嗎?可能不會。 – Dorian

+0

您必須從操作方法中觸發導航。這樣,您可以執行您的註銷代碼,然後將用戶發送到其他頁面。 – chkal

+0

我該如何使用此代碼做到這一點?我應該在onclick中留下「返回false」並將剩下的動作移走嗎? – Dorian