2012-05-13 123 views
0

我有一個問題,顯示模態面板與JSF 1.2 &豐富的面孔。由於項目限制,我必須使用jsp。 a4j commandLink確實提交給服務器,它回到瀏覽器,瀏覽器閃爍,但沒有顯示出來。顯示豐富的模態面板與JSF 1.2豐富的面孔錯誤

這是我在JSP中使用的片段

.... 
.... 
<f:view> 
.... 
.... 
<h:form id="buildForm"> 
.... 
.... 
    <a4j:commandLink id="showItem" action="#{popupBean.selectAttributeAction}" oncomplete="Richfaces.showModalPanel('modalPanelId',{width:550, top:200});" reRender="modalPanelId"> 
     Click Here! 
    </a4j:commandLink> 
    <rich:modalPanel id="modalPanelId" width="350" height="100"> 
     <!-- the external content is loaded inside this tag --> 
     <div id="modalPanelResult"> 
       This is test modal popup 
      </div> 
    </rich:modalPanel> 
.... 
.... 
</h:form> 
</f:view> 
.... 

這是我的錯誤,當我包括上述片段在我的jsp

panel.component is undefined 

...,opts);});};Richfaces.hideModalPanel=function(id,opts,event){var panel=$(id);if(... 

如果我用同樣的在一個單獨的測試jsp(如下所示) - 我創建的測試,它工作正常。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> 
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> 
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Insert title here</title> 
</head> 
<body> 

<f:view> 
    <a4j:commandLink id="showItem" action="#{popupBean.selectAttributeAction}" oncomplete="Richfaces.showModalPanel('modalPanelId',{width:550, top:200});" reRender="modalPanelId"> 
     Click Here! 
    </a4j:commandLink> 
    <rich:modalPanel id="modalPanelId" width="350" height="100"> 
     <!-- the external content is loaded inside this tag --> 
     <div id="modalPanelResult"> 
       This is test modal popup 
      </div> 
    </rich:modalPanel> 
</f:view> 
</body> 
</html> 

謝謝,我感謝你們的幫助。我花了幾天的時間努力做到這一點。我有另一個css解決方案,我用a4j jsfunction調用服務器後獲取彈出窗口的信息,並顯示覆蓋彈出窗口,但在Chrome中不起作用,它在IE中的工作與jQuery腳本代碼中的腳本錯誤,而不是在我的代碼,但在Firefox中運行良好,即當我切換到Richfaces解決方案時認爲它看起來非常成功,但是一旦我將測試工作(在單獨頁面上)解決方案包含到我的jsp中,它就無法工作。

+1

你嘗試提供諸如'#{豐富的替代JS API:組件(「MP」) } .show()'在鏈接(http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf?c=modalPanel#) –

+0

感謝@AhamedMustafaM花時間去通過我的問題,我試過# {rich:component('mp')}。show()以及它也不起作用。 SOmethign關於我的jsp導致了這種情況,我從UI設計人員那裏獲得了一個HTML,並將其更改爲jsp並添加了jsf部分。 –

+0

豐富的地方:modalPanel out of h:form – pudaykiran

回答

1

你試過下面的代碼:

<a4j:commandLink id="showItem" action="#{popupBean.selectAttributeAction}" reRender="modalPanelId"> 
    Click Here! 
<rich:componentControl for="modalPanelId" attachTo="showItem" operation="show" event="onclick" /> 
</a4j:commandLink> 

? 如果沒有,請你,得到了在這裏工作

0

這裏是例如如何打開豐富:modalPanel

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> 
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> 
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> 
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%> 
<f:view> 
    <head> 
     <title>User Registration</title> 
    </head> 
    <body> 
     <jsp:include page="/views/common/styles.jsp"></jsp:include> 
     <h:form id="userRegistrationForm"> 
      <table cellpadding="0" cellspacing="0" border="0" align="center"> 
       <tr class="rowspace5px"></tr> 
       <tr> 
        <td> 
         <table cellpadding="0" cellspacing="3" border="0"> 
          <tr> 
           <td> 
            <h:outputText styleClass="mandatorymarkwidth error" value="*"></h:outputText> 
           </td> 
           <td class="lblwidthfirstpair"> 
            <h:outputText styleClass="labelfont" value="Security Question"></h:outputText> 
           </td> 
           <td> 
            <h:inputText id="textSecurityQuestionId" styleClass="controlfont" disabled="true" value="#{UserRegistrationBean.textSecurityQuestion}"></h:inputText> 
           </td> 
           <td> 
            <h:commandButton image="/images/Add_Icon.gif" onclick="Richfaces.showModalPanel('securityQuestionPanel'); return false;"> 
             <a4j:support event="onclick" reRender="userRegistrationForm" oncomplete="Richfaces.showModalPanel('securityQuestionPanel');"></a4j:support> 
            </h:commandButton> 
           </td> 
          </tr> 
         </table> 
        </td> 
       </tr> 
      </table> 
     </h:form> 
     <rich:hotKey key="esc" handler="Richfaces.hideModalPanel('securityQuestionPanel');"></rich:hotKey> 
     <rich:modalPanel id="securityQuestionPanel" moveable="false" width="450" height="280" resizeable="false"> 
      <f:facet name="header"> 
       <h:outputText value="Security Question"></h:outputText> 
      </f:facet> 
      <f:facet name="controls"> 
       <h:panelGroup> 
        <h:graphicImage id="securityQuestionImage" value="../../images/close.png" styleClass="hidelink" style="cursor: pointer;" /> 
        <rich:componentControl for="securityQuestionPanel" attachTo="securityQuestionImage" operation="hide" event="onclick" /> 
       </h:panelGroup> 
      </f:facet> 
      <a4j:form id="securityQuestionForm"> 
       <table border="0" cellspacing="0" cellpadding="0" width=100%> 
        <tr class="trseperator5"></tr> 
        <tr> 
         <td> 
          <table cellpadding="0" cellspacing="0" border="0"> 
           <tr> 
            <td class="lblwidthfirstpair"> 
             . 
             . 
             . 
             . 
            </td> 
           </tr> 
          </table> 
         </td> 
        </tr> 
        <tr class="trseperator3"></tr> 
       </table> 
      </a4j:form> 
     </rich:modalPanel> 
    </body> 
</f:view>