I'm fairly new to this myself so maybe someone else can jump in. First
things first, put a print statement in the intercept methods of your
interceptors so you at least know if the interceptor is even getting
called.
Secondly, I didn't ever use a line like this:interceptorRefs = {
@InterceptorRef("loginClienteInterceptor") }) .
Other than that, I'm not sure what else to do.
Fabio Alves de Araujo Ebner - DnaSolution wrote:
Hey man, this is my structure
MY ACTION
package br.com.dnasolution.site.action;
/** import **//
@ParentPackage("my-secure")
public class OrdemServicoAction {
@Action(value = "cadastrarOrdemServico", results = {...@result(name =
"valido", location = "/jsp/ordemservico/cadastro_sucesso.jsp"),
@Result(name = "invalido", location =
"/jsp/ordemservico/cadastro_falha.jsp") }, interceptorRefs = {
@InterceptorRef("loginClienteInterceptor") })
public String cadastrarOrdemServico() {
/* code */
}
MY INTERCEPTOR
package br.com.dnasolution.site.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class LoginClienteInterceptor implements Interceptor {
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void init() {
// TODO Auto-generated method stub
}
@Override
public String intercept(ActionInvocation invocation) throws Exception {
if(invocation.getInvocationContext().getSession().get("clienteLogado")
!= null){
return invocation.invoke();
}else{
return "clienteNaoLogado";
}
}
}
AND MY STRUTS.XML
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
<package name="my-secure"
extends="struts-default">
<interceptors>
<interceptor name="loginUsuarioInterceptor"
class="br.com.dnasolution.site.interceptor.LoginUsuarioInterceptor">
</interceptor>
<interceptor name="loginClienteInterceptor"
class="br.com.dnasolution.site.interceptor.LoginClienteInterceptor">
</interceptor>
<interceptor-stack name="secureStack">
<interceptor-ref name="loginUsuarioInterceptor"/>
<interceptor-ref name="loginClienteInterceptor"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="secureStack"/>
<global-results>
<result name="clienteNaoLogado">/jsp/usuario/loginUsuario.jsp
</result>
<result name="clienteNaoLogado">/jsp/cliente/loginCliente.jsp
</result>
</global-results>
</package>
</struts>
and still dosen't work :(
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org