Oi pessoal ,tudo bom?
Estou criando uma aplicação utilizando JSF 2.0 e o Richfaces 4, e estou com um problema pra usar o "
Eu tenho um
cadastro_cidade.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head><title>Curriculo Salesiano</title>
<link rel="stylesheet" type="text/css" href="css/principal.css" />
<script type="text/javascript" src="js/jquery-1.5.2.min.js"/>
<script type="text/javascript" src="js/corTabela.js"/>
<script language="JavaScript">
function function1(elem) {
var d = elem.childNodes[0].innerHTML;
var e = elem.childNodes[1].innerHTML;
var f = elem.childNodes[2].innerHTML;
//alert("-"+d+"-"+e+"-"+f)
document.getElementById("FormCidade:itId").value=d;
document.getElementById("FormCidade:itIdOculto").value=d;
document.getElementById("FormCidade:somEstado").value=e;
document.getElementById("FormCidade:itNome").value=f;
}
</script>
</h:head>
<h:body>
<div align="center">
<rich:panel header="Cidade" >
<h:form id="FormCidade">
<h:panelGrid columnClasses="classONE,classTWO" columns="3">
<h:outputLabel>ID:</h:outputLabel>
<h:inputText id="itId" readonly="true" value="#{gravaCidade.cid_id}"/>
<h:outputLabel> </h:outputLabel>
<h:outputLabel >Estado:</h:outputLabel>
<h:selectOneMenu id="somEstado" value="#{gravaCidade.est_id}">
<f:selectItems value="#{listaEstado.suaLista}" var="u" itemLabel="#{u.est_sigla}" itemValue="#{u.est_id}" />
</h:selectOneMenu>
<h:outputLabel>*</h:outputLabel>
<h:outputLabel>Nome da cidade:</h:outputLabel>
<h:inputText id="itNome" required="true" value="#{gravaCidade.cid_nome}"/>
<h:outputLabel>*</h:outputLabel>
</h:panelGrid>
<h:inputHidden id="itIdOculto" value="#{gravaCidade.cid_id}"/>
<h:commandButton value="Limpar" type="reset" />
<h:commandButton action="#{gravaCidade.gravar}" value="Gravar" >
<rich:componentControl target="popup" operation="show" />
</h:commandButton>
<h:commandButton value="Excluir" action="#{gravaCidade.excluir}" />
</h:form>
</rich:panel>
<rich:popupPanel id="popup" modal="true" resizeable="true" >
<f:facet name="header">
<h:outputText value="Mensagem do Sistema" />
</f:facet>
<p>You can also check and trigger events if the use clicks outside of the
panel.</p>
<h:form>
<h:commandButton value="OK" action="cadastro_cidade" />
</h:form>
<p>In this example clicking outside closes the panel.</p>
<p><a href="#" onclick="#{rich:component('popup')}.hide()">Hide the panel</a></p>
</rich:popupPanel>
<br/><br/><br/>
<rich:panel header="Pesquisa" >
<h:form >
<h:inputText value="#{listaCidade.cid_nom}" />
<a4j:commandButton value="Pesquisar" render="out" action="#{listaCidade.filtrar}"/>
<br/><br/>
</h:form>
<a4j:outputPanel id="out">
<table border="1">
<tr>
<td>ID</td>
<td>Cidade</td>
<td>Estado</td>
</tr>
<a4j:repeat value="#{listaCidade.suaLista}" var="x">
<tr onclick="function1(this)" ><td>#{x.cid_id}</td><td style="display: none">#{x.estado.est_id}</td><td>#{x.cid_nom}</td><td >#{x.estado.est_sigla}</td></tr>
</a4j:repeat>
</table>
</a4j:outputPanel>
</rich:panel>
<h2><a href="inicio.jsf">Retornar a pagina Principal</a></h2>
</div></h:body></html>