Ошибка при отображении расширенной модальной панели с JSF 1.2 и расширенными лицами

У меня проблема с отображением модальной панели с JSF 1.2 и расширенными лицами. Я должен использовать jsp из-за ограничений проекта. Командная ссылка a4j действительно отправляется на сервер, и она возвращается в браузер, и браузер мигает, но ничего не появляется.

Это фрагмент, который я использовал в своем 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, которое я использовал после вызова jsfunction a4j на сервер, чтобы получить информацию для всплывающего окна и показать всплывающее окно оверлея, но оно не работает в Chrome и работает в IE с ошибкой сценария в коде сценария jquery, а не в моем коде , но отлично работает в Firefox, то есть когда я переключился на решение Richfaces, думая, что оно выглядит очень просто, но как только я включаю тестовое рабочее (на отдельной странице) решение в свой jsp, оно не работает.


person Surya Govi    schedule 13.05.2012    source источник
comment
Пробовали ли вы альтернативный JS API, например #{rich:component('mp')}.show() в ссылке (livedemo .exadel.com/richfaces-demo/richfaces/)   -  person Ahamed Mustafa M    schedule 14.05.2012
comment
Спасибо @AhamedMustafaM за то, что нашли время ответить на мой вопрос, я попробовал #{rich:component('mp')}.show(), но это тоже не работает. SOmethign о моем jsp вызывает это, я получил HTML от дизайнера пользовательского интерфейса и изменил его на jsp, а также добавил часть jsf.   -  person Surya Govi    schedule 14.05.2012
comment
Поместите rich:modalPanel из h:form   -  person UdayKiran Pulipati    schedule 31.05.2013


Ответы (2)


Вы пробовали следующий код:

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

? Если нет, пожалуйста, здесь это работает

person Community    schedule 14.08.2012

Вот пример, как открыть rich: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>
person UdayKiran Pulipati    schedule 31.05.2013