Pessoal, estou com um problema em um commandLink. Quando clico na ação correspondente, ela não é executada… Já fiz vários testes e não consegui resolver… Alguem pode me dar uma ajuda ai?
web.xml
<?xml version="1.0"?> javax.faces.CONFIG_FILES /WEB-INF/faces-config.xml javax.faces.STATE_SAVING_METHOD server org.apache.myfaces.COMPRESS_STATE_IN_SESSION true org.apache.myfaces.SERIALIZE_STATE_IN_SESSION true org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION 1 com.sun.faces.config.ConfigureListener Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.jsf BASICfaces-config.xml
<?xml version="1.0"?><!-- REGRAS DE NAVEGAÇÃO -->
<navigation-rule>
<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/sucessoLogin.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>falha</from-outcome>
<to-view-id>/falhaLogin.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/adicionarDados.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/sucessoInsercao.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>falha</from-outcome>
<to-view-id>/falhaInsercao.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/gerenciarUsuario.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/usuariosLocalizados.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>falha</from-outcome>
<to-view-id>/nenhumRegistro.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/usuariosLocalizados.jsp</from-view-id>
<navigation-case>
<from-outcome>sucessoDeletar</from-outcome>
<to-view-id>/falhaLogin.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>falhaDeletar</from-outcome>
<to-view-id>/falhaLogin.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>forwardEditar</from-outcome>
<to-view-id>/editarDadosUsuario.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>forwardFalhaEditar</from-outcome>
<to-view-id>/falhaEditarUsuario.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- BEANS DOS OBJETOS -->
<managed-bean>
<managed-bean-name>login</managed-bean-name>
<managed-bean-class>br.com.login.Login</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>usuario</managed-bean-name>
<managed-bean-class>br.com.login.usuarios.Usuarios</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<!-- BEANS DE NEGÓCIO -->
<managed-bean>
<managed-bean-name>autenticacao</managed-bean-name>
<managed-bean-class>br.com.login.AutenticacaoUsuario</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>negocioUsuario</managed-bean-name>
<managed-bean-class>br.com.login.usuarios.NUsuarios</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
NUsuarios.java
package br.com.login.usuarios;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
public class NUsuarios {
private Usuarios usuario = new Usuarios();
private String chaveConsulta = null;
private List listaUsuarios = null;
public String setUsuario() {
PUsuarios persistencia = new PUsuarios();
boolean result = persistencia.setUsuario(this.usuario);
if (result)
return "sucesso";
else
return "falha";
}
public String getUsuarios() {
PUsuarios persistencia = new PUsuarios();
this.listaUsuarios = persistencia.getUsuarios(this.chaveConsulta);
if (this.listaUsuarios.size() > 0)
return "sucesso";
else
return "falha";
}
public String editUsuario() {
System.out.println("No Editar");
return "forwardEditar";
}
public String delUsuario() {
return "sucessoDeletar";
}
public Usuarios getUsuario() {
return usuario;
}
public void setUsuario(Usuarios usuario) {
this.usuario = usuario;
}
public String getChaveConsulta() {
return chaveConsulta;
}
public void setChaveConsulta(String chaveConsulta) {
this.chaveConsulta = chaveConsulta;
}
public List getListaUsuarios() {
return listaUsuarios;
}
public void setListaUsuarios(List<Usuarios> listaUsuarios) {
this.listaUsuarios = listaUsuarios;
}
}
usuariosLocalizados.jsp
<%@ taglib uri=“http://java.sun.com/jsf/core” prefix=“f” %>
<%@ taglib uri=“http://java.sun.com/jsf/html” prefix=“h” %>
<%@ taglib uri=“http://myfaces.apache.org/tomahawk” prefix=“t”%>
<h:column>
<f:facet name="header">
<h:outputText value="Matrícula"/>
</f:facet>
<h:outputText value="#{user.matricula}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Nível"/>
</f:facet>
<h:outputText value="#{user.nivel}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Status"/>
</f:facet>
<h:outputText value="#{user.status}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Editar"/>
</f:facet>
<h:commandLink value="Editar" action="#{negocioUsuario.editUsuario}" actionListener="#{negocioUsuario.editUsuario}" immediate="true">
<f:param value="#{user.id}" name="id" />
</h:commandLink>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Excluir"/>
</f:facet>
<h:commandLink value="Excluir" action="#{negocioUsuario.delUsuario}" immediate="true">
<f:param value="#{user.id}" name="id" />
</h:commandLink>
</h:column>
</h:dataTable>
</h:form>
</f:view>
<table width="450" align="left">
<tr>
<td width="450" align="left">
<a href="sucessoLogin.jsf">Clique aqui para Voltar</a>
</td>
</tr>
</table>
</body>