show my var with @dataModelSelecion anotation in another page
diogossh Nov 9, 2010 10:31 AMI'm having problems with a variable display with annotation @datamodelselecion in another page;
The code below is where usuario.xhtml shows a grid of Users. I am wanting to click on a row of the grid and take the information that User on a another page ... but the information is not shown ..... could someone help me please ....
my usuario.xhtml :
<rich:dataTable id="GrdUsuarios" value="#{listaUsuario}" var="linha" onRowMouseOver="this.style.backgroundColor='#FFEBDA'"
onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'">
<rich:column filterBy="#{linha.id}" filterEvent="onkeyup" style="width:3%;">
<f:facet name="header">
<h:outputText value="Codigo" />
</f:facet>
<h:outputText value="#{linha.id}" />
</rich:column>
<rich:column filterBy="#{linha.nome}" filterEvent="onkeyup" style="width:65%;">
<f:facet name="header">
<h:outputText value="Nome" />
</f:facet>
<h:outputText value="#{linha.nome}" />
</rich:column>
<rich:column filterBy="#{linha.login}" filterEvent="onkeyup" style="width:10%;">
<f:facet name="header">
<h:outputText value="Login" />
</f:facet>
<h:outputText value="#{linha.login}" />
</rich:column>
<rich:column filterBy="#{linha.perfil}" filterEvent="onkeyup" style="width:10%;">
<f:facet name="header">
<h:outputText value="Perfil" />
</f:facet>
<h:outputText value="Administrador" rendered="#{linha.perfil.codigo eq '0'}" />
<h:outputText value="Tecnico" rendered="#{linha.perfil.codigo eq '1'}" />
<h:outputText value="Ze roela" rendered="#{linha.perfil.codigo eq '2'}" />
</rich:column>
<rich:column style="width:15%;">
<f:facet name="header">
<h:outputText value="Acoes" />
</f:facet>
<a4j:commandLink id="linkAlterar" reRender="panelMenu" action="#{usuarioAction.alterarUsuario()}">
<h:graphicImage value="/img/icon_editar.png" alt="Edidar" />
<a4j:actionparam name="panelCampos" value="itemCampos" assignTo="#{usuarioAction.panelSelected}"/>
<a4j:actionparam name="panelLabel" value="Alteracao" assignTo="#{usuarioAction.panelLabel}"/>
</a4j:commandLink>
<rich:spacer width="10"/>
<a4j:commandLink id="linkRemove" reRender="panelMenu" action="#{usuarioAction.deletaUsuario()}">
<h:graphicImage value="/img/icon_lixeira.png" alt="Excluir"/>
</a4j:commandLink>
<rich:spacer width="10"/>
// When I click that link below, I want to get the line information and display in another page
<a4j:commandLink id="linkPermissoes" action="usuarioProcesso"> //action i go to usuarioProcesso.xhtml
<h:graphicImage value="/img/btnnewrole.png" />
</a4j:commandLink>
the class below is my UsuarioAction.java:
@Name("usuarioAction")
@Scope(ScopeType.CONVERSATION)
public class UsuarioAction {
@In(required=false)
@Out(required=false)
private Usuario usuario;
@In
private EntityManager entityManager;
@In
@Out
FacesMessages facesMessages;
@DataModel
List<Usuario> listaUsuario;
@DataModelSelection
@Out(required=false)
Usuario usuarioSelecionado;
this is my code below another page where I want to show the information in the selected User grid usuario.xhtml:
<rich:panel>
<f:facet name="header">Manutencao de Acessos</f:facet>
<fieldset><legend>Usuario</legend>
<h:form id="frmUsuarioProcessos">
<h:panelGrid id="GrdUsuarioSelecionado" columns="1">
<p><h:outputLabel value="Codigo: #{usuarioSelecionado.id}" /></p>
<p><h:outputLabel value="Nome: #{usuarioSelecionado.nome}" /></p>
</h:panelGrid>
</h:form>
</fieldset>
</rich:panel>
could someone help me because the information is not ejecting to another page
thanks
The code below is where usuario.xhtml shows a grid of Users. I am wanting to click on a row of the grid and take the information that User on a another page ... but the information is not shown ..... could someone help me please ....
my usuario.xhtml :
<rich:dataTable id="GrdUsuarios" value="#{listaUsuario}" var="linha" onRowMouseOver="this.style.backgroundColor='#FFEBDA'"
onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'">
<rich:column filterBy="#{linha.id}" filterEvent="onkeyup" style="width:3%;">
<f:facet name="header">
<h:outputText value="Codigo" />
</f:facet>
<h:outputText value="#{linha.id}" />
</rich:column>
<rich:column filterBy="#{linha.nome}" filterEvent="onkeyup" style="width:65%;">
<f:facet name="header">
<h:outputText value="Nome" />
</f:facet>
<h:outputText value="#{linha.nome}" />
</rich:column>
<rich:column filterBy="#{linha.login}" filterEvent="onkeyup" style="width:10%;">
<f:facet name="header">
<h:outputText value="Login" />
</f:facet>
<h:outputText value="#{linha.login}" />
</rich:column>
<rich:column filterBy="#{linha.perfil}" filterEvent="onkeyup" style="width:10%;">
<f:facet name="header">
<h:outputText value="Perfil" />
</f:facet>
<h:outputText value="Administrador" rendered="#{linha.perfil.codigo eq '0'}" />
<h:outputText value="Tecnico" rendered="#{linha.perfil.codigo eq '1'}" />
<h:outputText value="Ze roela" rendered="#{linha.perfil.codigo eq '2'}" />
</rich:column>
<rich:column style="width:15%;">
<f:facet name="header">
<h:outputText value="Acoes" />
</f:facet>
<a4j:commandLink id="linkAlterar" reRender="panelMenu" action="#{usuarioAction.alterarUsuario()}">
<h:graphicImage value="/img/icon_editar.png" alt="Edidar" />
<a4j:actionparam name="panelCampos" value="itemCampos" assignTo="#{usuarioAction.panelSelected}"/>
<a4j:actionparam name="panelLabel" value="Alteracao" assignTo="#{usuarioAction.panelLabel}"/>
</a4j:commandLink>
<rich:spacer width="10"/>
<a4j:commandLink id="linkRemove" reRender="panelMenu" action="#{usuarioAction.deletaUsuario()}">
<h:graphicImage value="/img/icon_lixeira.png" alt="Excluir"/>
</a4j:commandLink>
<rich:spacer width="10"/>
// When I click that link below, I want to get the line information and display in another page
<a4j:commandLink id="linkPermissoes" action="usuarioProcesso"> //action i go to usuarioProcesso.xhtml
<h:graphicImage value="/img/btnnewrole.png" />
</a4j:commandLink>
the class below is my UsuarioAction.java:
@Name("usuarioAction")
@Scope(ScopeType.CONVERSATION)
public class UsuarioAction {
@In(required=false)
@Out(required=false)
private Usuario usuario;
@In
private EntityManager entityManager;
@In
@Out
FacesMessages facesMessages;
@DataModel
List<Usuario> listaUsuario;
@DataModelSelection
@Out(required=false)
Usuario usuarioSelecionado;
this is my code below another page where I want to show the information in the selected User grid usuario.xhtml:
<rich:panel>
<f:facet name="header">Manutencao de Acessos</f:facet>
<fieldset><legend>Usuario</legend>
<h:form id="frmUsuarioProcessos">
<h:panelGrid id="GrdUsuarioSelecionado" columns="1">
<p><h:outputLabel value="Codigo: #{usuarioSelecionado.id}" /></p>
<p><h:outputLabel value="Nome: #{usuarioSelecionado.nome}" /></p>
</h:panelGrid>
</h:form>
</fieldset>
</rich:panel>
could someone help me because the information is not ejecting to another page
thanks