d34d_d3v1l 19 de mar. de 2013
que tal um pedacinho de código pra gente ver?
matheus_paulo93 19 de mar. de 2013
Página
<html 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:p= "http://primefaces.org/ui"
xmlns:rich= "http://richfaces.org/rich"
xmlns:a4j= "http://richfaces.org/a4j"
xmlns:t= "http://myfaces.apache.org/tomahawk"
xmlns:c= "http://java.sun.com/jsp/jstl/core" >
<ui:composition template= "/jsf/templates/TemplatePrincipal.xhtml" >
<ui:define name= "corpo" >
<ui:param name= "Master" value= "#{test}" ></ui:param>
<p:outputLabel value= "Nome: " />
<p:inputText value= "#{Master.daoMaster.c100002}" /><br/>
<p:outputLabel value= "Nome completo: " />
<p:inputText value= "#{Master.daoMaster.c100003}" /><br/>
<p:selectOneRadio value= "#{Master.daoMaster.c100004.c70001}" >
<c:forEach items= "#{Master.listaT700}" var= "item" >
<f:selectItem itemLabel= "#{item.c70002}" itemValue= "#{item.c70001}" />
</c:forEach>
</p:selectOneRadio>
<p:outputLabel value= "Data Nasc: " />
<p:calendar value= "#{Master.daoMaster.c100005}" /><br/>
<a4j:commandButton value= "Cadastrar" action= "#{Master.gravar}" />
<a4j:commandButton value= "Pesquisar" action= "#{Master.pesquisar}" />
<a4j:commandButton value= "Preparar" action= "#{Master.preparar}" />
<p:dataTable value= "#{Master.listaBeanMaster}" var= "item" >
<p:column>
<f:facet name= "header" >
<h:outputText value= "Nome" />
</f:facet>
<h:outputText value= "#{item.c100002}" />
</p:column>
<p:column>
<f:facet name= "header" >
<h:outputText value= "Nome completo" />
</f:facet>
<h:outputText value= "#{item.c100003}" />
</p:column>
<p:column>
<f:facet name= "header" >
<h:outputText value= "Tipo Pessoa" />
</f:facet>
<h:outputText value= "#{item.c100004.c70002}" />
</p:column>
<p:column>
<f:facet name= "header" >
<h:outputText value= "Data de nascimento" />
</f:facet>
<h:outputText value= "#{item.c100005}" />
</p:column>
<p:column>
<f:facet name= "header" >
</f:facet>
<a4j:commandButton value= "Editar" action= "#{Master.editar(item.c100001)}" />
</p:column>
</p:dataTable>
</ui:define>
</ui:composition>
</html>
método no managedBean
public void editar ( Integer id ) {
try {
for ( T item : listaBeanMaster ) {
if ( id == item .getID ()) {
daoMaster = item ;
}
}
}catch ( Exception e ) {
e .printStackTrace () ;
}
}
d34d_d3v1l 19 de mar. de 2013
Cara…
da uma lida sobre a diff entre action e actionListener…