Boa noite pesssoal, estou utilizando rich:modalPanel para abrir janela modal de aviso de erros, e só não funciona em algumas páginas JSP:
Erro console do Firefox: Erro: Prototype.Browser is undefined
Arquivo-fonte: http://localhost:8080/GestBlinder/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/modalPanel.js.jsf
Linha: 28
Erro pelo Firebug: linha 28 ModalPanel.panels.push(this);
this.eventFirstOnfocus=this.firstOnfocus.bindAsEventListener(this);this.eventLastOnfocus=this.lastOnfocus.bindAsEventListener(this);this.firstHref=id+“FirstHref”;this.lastHref=id+“LastHref”;this.selectBehavior=options.selectBehavior;},_saveInputValues:function(element){if(Prototype.Browser.IE){var inputs=element.getElementsByTagName(‘input’);if(inputs){for({var i=0;i<inputs.length;i++)var input=inputs[i];if(input.type==‘checkbox’||input.type==‘radio’){input.defaultChecked=input.checked;}}}}},width:function(){return this.getSizedElement().clientWidth;},height:function(){return this.getSizedElement().clientHeight;},getSizedElement:function(){if(!this._sizedElement){this._sizedElement=$(this.cdiv);}
segue meu código:
mensagens.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<%@ taglib uri="http://jsftutorials.net/htmLib" prefix="htm" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<f:subview id="s_mensagens1" rendered="#{not empty facesContext.maximumSeverity}">
<rich:modalPanel id="msgsErros" autosized="true"
showWhenRendered="#{not empty facesContext.maximumSeverity}">
<f:facet name="header">
<h:outputText id="outputMsgs" value="Mensagem!" />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage id="mensagens2" onclick="Richfaces.hideModalPanel('msgsErros')" value="#{pageContext.request.contextPath}/images/48x48/cancel_48x48.png" style="cursor: pointer; margin-top: 0px;" width="20" height="20"/>
<!--<rich:componentControl for="msgsErros" attachTo="mensagens2" operation="hide" event="onclick" />-->
</h:panelGroup>
</f:facet>
<htm:table id="tableMensagens" styleClass="messages" >
<htm:tr>
<htm:td>
<rich:messages >
<f:facet name="fatalMarker" >
<h:graphicImage id="imgFatal" value="#{pageContext.request.contextPath}/images/48x48/error_48x48.png" width="40" height="40"/>
</f:facet>
<f:facet name="warnMarker">
<h:graphicImage id="imgWarn" value="#{pageContext.request.contextPath}/images/64x64/messagebox_warning_64x64.png" width="40" height="40"/>
</f:facet>
<f:facet name="infoMarker">
<h:graphicImage id="imgInfo" value="#{pageContext.request.contextPath}/images/48x48/check_48x48.png" width="40" height="40"/>
</f:facet>
</rich:messages>
</htm:td>
</htm:tr>
</htm:table>
</rich:modalPanel>
</f:subview>
Depois chamo nas páginas assim: <c:import url="…/mensagens.jsp"></c:import>
Funciona na maioria das páginas, mas tem algumas como esta não funciona:
<%@ page language="java" contentType="text/html;" pageEncoding="ISO-8859-1"%>
<%-- JSF tag library declaration --%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://jsftutorials.net/htmLib" prefix="htm" %>
<%-- RichFaces tag library declaration --%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%-- JSTL tag library declaration --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%-- Apache Myfaces tag library declaration --%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<f:view>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Gest Blinder</title>
<f:loadBundle basename="br.com.gest.languages.messages" var="msgs"/>
<a4j:loadStyle src="#{pageContext.request.contextPath}/css/principal.css"></a4j:loadStyle>
<script type="text/javascript" src="../js/util.js" charset="utf-8" ></script>
<a4j:loadScript src="#{pageContext.request.contextPath}/js/jquery.meio.mask.js"></a4j:loadScript>
<script type="text/javascript">
function setMask(e) {
var control = $((e.target ? e.target : e.srcElement).id);
if (control.createTextRange) {
var range = control.createTextRange();
range.collapse(false);
range.select();
}
else if (control.setSelectionRange) {
control.focus();
var length = control.value.length;
control.setSelectionRange(length, length);
}
control.selectionStart = control.selectionEnd = control.value.length;
document.getElementById("form").submit();
}
</script>
</head>
<body >
<c:import url="../mensagens.jsp"></c:import>
<htm:div id="divPrincipal" styleClass="corpoPrincipal">
<c:import url="../cabecalho.jsp"></c:import>
<c:import url="../menu.jsp"></c:import>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form id="form" >
<htm:div styleClass="corpoEsquerdaForm">
<rich:panel style="width:100%;">
<f:facet name="header" >
<h:outputText style="text-align: center;" value="#{msgs.currentAccountTitle}"/>
</f:facet>
<htm:table border="0" cellpadding="2" cellspacing="2" >
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:75px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputCode}"/> </htm:td>
<htm:td style="width:119px;"><h:inputText id="codigo" maxlength="15" style="width:119px;text-align:right;" value="#{contaCorrenteController.contaCorrente.codigo}" readonly="true" /></htm:td>
<htm:td style="width:90px;text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputAccountName}"/> </htm:td>
<htm:td style="width:280px;"><h:inputText id="nomeConta" maxlength="40" style="width:270px;" value="#{contaCorrenteController.contaCorrente.nomeConta}" /></htm:td>
<htm:td style="width:90px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputContact}"/> </htm:td>
<htm:td><h:inputText id="contato" maxlength="50" style="width:180px" value="#{contaCorrenteController.contaCorrente.contato}"/></htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:75px;text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountSelectAccountType}"/> </htm:td>
<htm:td style="width:131px;">
<h:selectOneMenu value="#{contaCorrenteController.contaCorrente.tipo}" style="width:131px;" >
<f:selectItem itemLabel="" itemValue="0" />
<f:selectItem itemLabel="#{msgs.currentAccountSelectItem1}" itemValue="1" />
<f:selectItem itemLabel="#{msgs.currentAccountSelectItem2}" itemValue="2" />
<f:selectItem itemLabel="#{msgs.currentAccountSelectItem3}" itemValue="3" />
</h:selectOneMenu>
</htm:td>
<htm:td style="width:90px;text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputBankName}"/> </htm:td>
<htm:td style="width:280px;"><h:inputText id="banco" maxlength="40" style="width:270px;" value="#{contaCorrenteController.contaCorrente.banco}" /></htm:td>
<htm:td style="width:90px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputNRCC}"/> </htm:td>
<htm:td><h:inputText id="nrcc" maxlength="50" style="width:180px; text-align:right;" value="#{contaCorrenteController.contaCorrente.nrcc}"/></htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:75px;text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputAgency}"/> </htm:td>
<htm:td style="width:119px;"><h:inputText id="agencia" maxlength="20" style="width:119px; text-align:right;" value="#{contaCorrenteController.contaCorrente.agencia}"/></htm:td>
<htm:td style="width:90px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputAbrev}"/> </htm:td>
<htm:td style="width:90px;"><h:inputText id="ctaAbrev" maxlength="6" style="width:75px;" value="#{contaCorrenteController.contaCorrente.ctaAbrev}" /></htm:td>
<htm:td style="width:90px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputOpeningDate}"/> </htm:td>
<htm:td style="width:102px;">
<rich:jQuery selector="#dataAbertura" query="setMask({mask:'99/99/9999'})" timing="onload" />
<t:inputCalendar id="dataAbertura" maxlength="11" style="width:58px;text-align:right;" value="#{contaCorrenteController.contaCorrente.dataAbertura}" renderAsPopup="true" renderPopupButtonAsImage="true" immediate="true" popupButtonImageUrl="../images/16x16/calendario_16x16.png">
<f:convertDateTime type="date" pattern="dd/MM/yyyy"/>
</t:inputCalendar>
</htm:td>
<htm:td style="width:90px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputOpeningBalance}"/> </htm:td>
<htm:td><h:inputText id="saldoAbertura" maxlength="15" style="width:180px;text-align:right;" converter="moedaConverter" value="#{contaCorrenteController.contaCorrente.saldoAbertura}"/></htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:75px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputPhone}"/> </htm:td>
<htm:td style="width:80px;">
<rich:jQuery selector="#fone" query="setMask({mask:'([telefone removido]'})" timing="onload"/>
<h:inputText id="fone" maxlength="13" style="width:75px;text-align:right;" value="#{contaCorrenteController.contaCorrente.telefone}" />
</htm:td>
<htm:td style="width:134px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputStatus}"/> </htm:td>
<htm:td style="width:90px;">
<h:selectOneMenu value="#{contaCorrenteController.contaCorrente.status}" style="width:87px;" >
<f:selectItem itemLabel="#{msgs.active}" itemValue="1" />
<f:selectItem itemLabel="#{msgs.inactive}" itemValue="0" />
</h:selectOneMenu>
</htm:td>
<htm:td style="width:178px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountCheckboxReference}"/> <h:selectBooleanCheckbox value="#{contaCorrenteController.contaCorrente.referencia}"/></htm:td>
<htm:td style="text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountCheckboxDeposit}"/> <h:selectBooleanCheckbox value="#{contaCorrenteController.contaCorrente.deposito}"/></htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:75px; text-align: right;"><h:outputText styleClass="labelInput" value="#{msgs.currentAccountInputObs}"/> </htm:td>
<htm:td ><h:inputTextarea id="observacao" rows="2" style="width:782px;" value="#{contaCorrenteController.contaCorrente.observacao}"/></htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
<htm:tr>
<htm:td>
<htm:table border="0" style="width:100%;" cellpadding="0" cellspacing="0" >
<htm:tr>
<htm:td style="width:50px;" > </htm:td>
<htm:td style="width:390px;" ><h:outputText styleClass="labelInput" value="#{msgs.requiredField}" /></htm:td>
<htm:td style="text-align:right;"><h:outputText styleClass="labelInput" value="#{msgs.registrationDate}"/> </htm:td>
<htm:td style="width:130px;">
<h:outputText styleClass="outputText" value="#{contaCorrenteController.contaCorrente.cadastro}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm:ss"/>
</h:outputText>
<h:inputHidden value="#{contaCorrenteController.contaCorrente.cadastro}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm:ss"/>
</h:inputHidden>
</htm:td>
<htm:td><h:outputText styleClass="labelInput" value="#{msgs.changeDate}"/></htm:td>
<htm:td style="width:130px;">
<h:outputText styleClass="outputText" value="#{contaCorrenteController.contaCorrente.alteracao}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm:ss"/>
</h:outputText>
<h:inputHidden value="#{contaCorrenteController.contaCorrente.alteracao}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm:ss"/>
</h:inputHidden>
</htm:td>
</htm:tr>
</htm:table>
</htm:td>
</htm:tr>
</htm:table>
</rich:panel>
</htm:div><!-- /corpoEsquerda -->
<htm:div styleClass="corpoDireitaForm">
<a4j:commandButton styleClass="botao" id="botaoPgPrincipal" value="#{msgs.buttonMainPage}" action="paginaPrincipal" ></a4j:commandButton>
<a4j:commandButton styleClass="botao" id="botaoNovo" value="#{msgs.buttonNew}" action="#{contaCorrenteController.novo}" ></a4j:commandButton>
<a4j:commandButton styleClass="botao" id="botaoList" value="#{msgs.buttonList}" action="listarContaCorrentes" ></a4j:commandButton>
<a4j:commandButton styleClass="botao" id="botaoSalvar" value="#{msgs.buttonSave}" action="#{contaCorrenteController.alterar}" rendered="#{not empty contaCorrenteController.contaCorrente.codigo}"></a4j:commandButton>
<a4j:commandButton styleClass="botao" id="botaoIncluir" value="#{msgs.buttonInclude}" action="#{contaCorrenteController.incluir}" rendered="#{empty contaCorrenteController.contaCorrente.codigo}"></a4j:commandButton>
</htm:div><!-- /corpoDireita -->
</h:form>
</ui:composition>
</htm:div><!-- /divPrincipal -->
</body>
</f:view>
</html>
Já pesquisei e não consegui uma solução, pode estar debaixo do meu nariz e não estou vendo, rsrs, alguém já passou por isso?