Richfaces showmodal

5 respostas
S

Galera estou com grande problema q nao estou consiguindo resolver como estou começando a mexer com ajax4jsf e richfaces estou apanhando d+. Bom minha duvida eh q qdo abri meu modalPanel consigo visualizar o header e controls agora o que vem abaixo nao consigo vou colocar meu codigo se puderem me ajudar !

<%@ page language="java" 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://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

	<link rel="stylesheet" type="text/css" href="./css/novoestilo.css">


</head>
  
<body background="./css/images/sebrae_fundo.gif">
	<f:view>
	<h:form id="cadastroservicos">
		<table height="100%" width="80%" align="center" >		
			<tr>
				<td align="center">								
					<div style="height: 100%;width: 100% " align="center" id="cab" style="background-color: #F5F5F5;">
						<div id="formulariofundo" style="text-align: center">Cadastro de Serviços</div>	
						<div style="height: 5%"></div>	
						
						<div id="col_esq" style="text-align: center;" >
							<label style="font-size: 18" >Tipo de Serviço:</label>
						</div>		
												
						<div id="col_dir">
							<h:selectOneListbox size="1" id="servicos" 
							onchange="submit()" valueChangeListener="#{servicos.servicosChanged}">
								<f:selectItems value="#{servicos.cadServicoBean.listaServico}"/>
							</h:selectOneListbox>							
						</div>
						
						<div style="height: 7%"></div>
											
											
						<div style="height: 3%">	
							<h:messages id="txterro" errorStyle="color:red" infoStyle="color:#DC143C" layout="list" />											
						</div>												
						
						<div style="height: 7%"></div>
												
						<div id="col_esq" style="text-align: center;font-size: 18;" >
							<label style="font-size: 18">Digite o Serviço:</label>						
						</div>
						
						<div id="col_pri" style="width: 20%">
							<h:inputText id="iptxtServico"></h:inputText>														
						</div>
						
						<div id="col_dir" style="width: 20%" align="right">
							<h:commandButton id="btAdicionar" value="Adicionar" actionListener="#{servicos.adicionarServicosChanged}" action="#{servicos.act}"></h:commandButton>													
						</div>
						
						<div style="height: 5%"></div>	
						
						<div id="col_esq" style="font-size: 18" align="center">
						 <h:selectBooleanCheckbox id="chkboxservicos" valueChangeListener="#{servicos.servicoschkboxChanged}" converter="javax.faces.Boolean" onclick="submit()"></h:selectBooleanCheckbox>Detalhamento: 
						 </div>		
						 
						 
						 <div id="col_pri" style="width: 20%">							 	
							<h:inputText id="iptxtDetalhamento" disabled="#{servicos.isFlag}"></h:inputText>														
						 </div>	
						
												
						<div id="col_dir" style="width: 20%" align="right"> 
[b]<!-- AKI EH A CHAMADA -->[/b]
							<a4j:commandButton reRender="testemod" onclick="javascript:Richfaces.showModalPanel('cadastroservicos:excluir')" value="Remover">
								<a4j:support event="onclick" onsubmit="true"></a4j:support>
							</a4j:commandButton> 
						</div>
						 
						 <div style="height: 2%"></div>	
						
						<div style="background: #bfd7f0;font-size: 5; height: 1%" ></div>
						
						<div style="height: 3%;font-size: 1">.</div>
												
						<div id="col_esq">
							<label style="font-size: 18">Serviços Cadastrados:</label>
						</div>
						
						<div style="height: 1%">
							
						</div>
						
						<div id="col_esq">							
							<h:selectOneListbox size="10"></h:selectOneListbox>
						</div>
						
						<div style="height: 40%"></div>
						
						<div>
							<label style="font-size: 11">2008 - Sebrae/GO - Avaliação de Fornecedores - Todos os direitos reservados. </label>
						</div>												
					</div>
				</td>			
			</tr>		
		</table>	
		
		<!-- MODALPANEL -->
		<rich:modalPanel id="excluir" width="350" height="200" left="auto" top="auto">
			<f:facet name="header">
				<h:outputText value="test"></h:outputText>
			</f:facet>		
			<f:facet name="controls">
		         <h:panelGroup>
		              <h:graphicImage value="./css/images/close.JPG" onclick="Richfaces.hideModalPanel('cadastroservicos:excluir')" 
			               style="cursor:pointer" id="hidelink"/>					                
		          </h:panelGroup>					
        	</f:facet> 

[b]<!-- ESSA PARTE P BAIXO Ñ APARECE-->[/b]
        	<rich:panel id="testemod">
	        	<h:outputText binding="#{servicos.msgErro}" id="msgErro" style="left: 24px; top: 216px; position: absolute"/>
        	</rich:panel> 
		</rich:modalPanel>
		
	</h:form>
	</f:view>
</body>
</html>

Obrigado a todos.

5 Respostas

D

opa

Cara tenta botar o modalPanel dentro da tag <f:subiew></f:subview>

e vew como ta o exemplo do site
http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf;jsessionid=280F473FFAB6999A6CDD5E3FAD8F1F40?c=modalPanel

e aqui descreve direitinho o componente modalPanel
http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/modalPanel.html

boa sorte =P

M

Olá td bem?

Tente colocar o modalPanel do richFaces dentro de um a4j:form, mas lembre-se que tem q fechar antes o <h:form>
Exemplo:

<%@ page language="java" 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://java.sun.com/jsp/jstl/core" prefix="c" %>   
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>   
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>   
  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">   
<html>   
<head>   
  
    <link rel="stylesheet" type="text/css" href="./css/novoestilo.css">   
  
  
</head>   
     
<body background="./css/images/sebrae_fundo.gif">   
    <f:view>   
    <h:form id="cadastroservicos">   
        <table height="100%" width="80%" align="center" >       
            <tr>   
                <td align="center">                                 
                    <div style="height: 100%;width: 100% " align="center" id="cab" style="background-color: #F5F5F5;">   
                        <div id="formulariofundo" style="text-align: center">Cadastro de Serviços</div>   
                        <div style="height: 5%"></div>     
                           
                        <div id="col_esq" style="text-align: center;" >   
                            <label style="font-size: 18" >Tipo de Serviço:</label>   
                        </div>           
                                                   
                        <div id="col_dir">   
                            <h:selectOneListbox size="1" id="servicos"   
                            onchange="submit()" valueChangeListener="#{servicos.servicosChanged}">   
                                <f:selectItems value="#{servicos.cadServicoBean.listaServico}"/>   
                            </h:selectOneListbox>                           
                        </div>   
                           
                        <div style="height: 7%"></div>   
                                               
                                               
                        <div style="height: 3%">     
                            <h:messages id="txterro" errorStyle="color:red" infoStyle="color:#DC143C" layout="list" />                                               
                        </div>                                                   
                           
                        <div style="height: 7%"></div>   
                                                   
                        <div id="col_esq" style="text-align: center;font-size: 18;" >   
                            <label style="font-size: 18">Digite o Serviço:</label>                         
                        </div>   
                           
                        <div id="col_pri" style="width: 20%">   
                            <h:inputText id="iptxtServico"></h:inputText>                                                         
                        </div>   
                           
                        <div id="col_dir" style="width: 20%" align="right">   
                            <h:commandButton id="btAdicionar" value="Adicionar" actionListener="#{servicos.adicionarServicosChanged}" action="#{servicos.act}"></h:commandButton>                                                     
                        </div>   
                           
                        <div style="height: 5%"></div>     
                           
                        <div id="col_esq" style="font-size: 18" align="center">   
                         <h:selectBooleanCheckbox id="chkboxservicos" valueChangeListener="#{servicos.servicoschkboxChanged}" converter="javax.faces.Boolean" onclick="submit()"></h:selectBooleanCheckbox>Detalhamento:   
                         </div>         
                           
                           
                         <div id="col_pri" style="width: 20%">                                   
                            <h:inputText id="iptxtDetalhamento" disabled="#{servicos.isFlag}"></h:inputText>                                                           
                         </div>     
                           
                                                   
                        <div id="col_dir" style="width: 20%" align="right">   
[b]<!-- AKI EH A CHAMADA -->[/b]   
                            <a4j:commandButton reRender="testemod" onclick="javascript:Richfaces.showModalPanel('cadastroservicos:excluir')" value="Remover">   
                                <a4j:support event="onclick" onsubmit="true"></a4j:support>   
                            </a4j:commandButton>   
                        </div>   
                           
                         <div style="height: 2%"></div>   
                           
                        <div style="background: #bfd7f0;font-size: 5; height: 1%" ></div>   
                           
                        <div style="height: 3%;font-size: 1">.</div>   
                                                   
                        <div id="col_esq">   
                            <label style="font-size: 18">Serviços Cadastrados:</label>   
                        </div>   
                           
                        <div style="height: 1%">   
                               
                        </div>   
                           
                        <div id="col_esq">                               
                            <h:selectOneListbox size="10"></h:selectOneListbox>   
                        </div>   
                           
                        <div style="height: 40%"></div>   
                           
                        <div>   
                            <label style="font-size: 11">2008 - Sebrae/GO - Avaliação de Fornecedores - Todos os direitos reservados. </label>   
                        </div>                                                   
                    </div>   
                </td>           
            </tr>       
        </table>     

[b]<!-- Repare AKIIII-->[/b]   
    </h:form>   
    <a4j:form>
        <!-- MODALPANEL -->   
        <rich:modalPanel id="excluir" width="350" height="200" left="auto" top="auto">   
            <f:facet name="header">   
                <h:outputText value="test"></h:outputText>   
            </f:facet>           
            <f:facet name="controls">   
                 <h:panelGroup>   
                      <h:graphicImage value="./css/images/close.JPG" onclick="Richfaces.hideModalPanel('cadastroservicos:excluir')"   
                           style="cursor:pointer" id="hidelink"/>                                       
                  </h:panelGroup>                   
            </f:facet>   
  
[b]<!-- ESSA PARTE P BAIXO Ñ APARECE-->[/b]   
            <rich:panel id="testemod">   
                <h:outputText binding="#{servicos.msgErro}" id="msgErro" style="left: 24px; top: 216px; position: absolute"/>   
            </rich:panel>   
        </rich:modalPanel>   
     </a4j:form>

    </f:view>   
</body>   
</html>

Espero ter ajudado!!!

S

davifm eu tinha peskisado nesses sites ñ consegui resolver atraves deles

markinho testei agora o q vc me falou mas sem sucesso ficou assim

</h:form> <!-- AKI FECHEI O FORM --> 

		<!-- MODALPANEL -->
		
		<a4j:form id="testesub">
		<rich:modalPanel id="excluir" minHeight="200" minWidth="450" height="200" width="500" zindex="2000">
			<f:facet name="header">
				<h:outputText value="test"></h:outputText>
			</f:facet>		
			<f:facet name="controls">
		         <h:panelGroup>
		              <h:graphicImage value="./css/images/close.JPG" onclick="Richfaces.hideModalPanel('testesub:excluir')" 
			               style="cursor:pointer" id="hidelink"/>					                
		          </h:panelGroup>					
        	</f:facet>
        	
        	<rich:panel id="testemod" style="align: center">
	        	<h:outputText value="This panel is called using Component Control Component"></h:outputText>
			        <br/>
		        <h:outputText value="Closure link (X) works also through Component Control"></h:outputText>
        	</rich:panel> 
        	
		</rich:modalPanel>
		</a4j:form>

na hora da chamada ficou

<a4j:commandButton reRender="testesub:testemod" onclick="javascript:Richfaces.showModalPanel('testesub:excluir')" value="Remover">
	<a4j:support event="onclick" onsubmit="true"></a4j:support>
</a4j:commandButton>
  • infelizmente n deu certo Mto Obrigado a vcs vou continuar peskisando caso encontre postarei aki. No q puderem me ajudar agradeço.
M

Então eu sou novo com JSF, mas também estou utilizando um modalPanel no meu ele fika ssim … de uma olhada!!!

</h:form> <!-- AKI FECHEI O FORM -->   
  
        <!-- MODALPANEL -->   
           

        <rich:modalPanel id="excluir" minHeight="200" minWidth="450" height="200" width="500" zindex="2000">   
            <f:facet name="header">   
                <h:outputText value="test"></h:outputText>   
            </f:facet>           
            <f:facet name="controls">   
                 <h:panelGroup>   
                      <h:graphicImage value="./css/images/close.JPG" onclick="Richfaces.hideModalPanel('testesub:excluir')"   
                           style="cursor:pointer" id="hidelink"/>                                       
                  </h:panelGroup>                   
            </f:facet>   
<!-- AKI ABRI O FORM -->   
        <a4j:form id="testesub">                  
            <rich:panel id="testemod" style="align: center">   
                <h:outputText value="This panel is called using Component Control Component"></h:outputText>   
                    <br/>   
                <h:outputText value="Closure link (X) works also through Component Control"></h:outputText>   
            </rich:panel>   
  <!-- AKI FECHEI O FORM -->   
        </a4j:form>  
               
        </rich:modalPanel>

se quiser de uma olhada nesse tópico que por sorte eu criei!
rsrsrsrsrs

http://www.guj.com.br/posts/list/96268.java

abrass. muita sorte pra vc!!

S

Markinho n esta dando certo p todo lado q eu mexo so aparece assim (segue a imagem em anexo) poxa mto estranho . Obrigado

Criado 31 de julho de 2008
Ultima resposta 31 de jul. de 2008
Respostas 5
Participantes 3