Here's how I do it:
struts.xml:
<package name="my-secure" extends="my-default">
<interceptors>
<interceptor name="authenticationInterceptor"
class="interceptors.AuthenticationInterceptor" />
<interceptor-stack name="secureStack">
<interceptor-ref name="authenticationInterceptor" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="secureStack" />
</package>
where my-default is another package that extends struts-default,
Then I have a package-info.java file in each package that has actions
that need to use this interceptor, for example:
@ParentPackage("my-secure")
package actions.secure;
import org.apache.struts2.convention.annotation.ParentPackage;
Note, I'm using the convention plugin
Fabio Alves de Araujo Ebner - DnaSolution wrote:
so i put in my aciotn
ParentPackage("loginClienteAndUsuario")
and i got the same problem
----- Original Message ----- From: "JP Cafaro" <jcafar...@gmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Monday, July 12, 2010 2:18 PM
Subject: Re: Help Struts2 + interceptor
The action has to be a part of that package, it has to extend that
package.
Fabio Alves de Araujo Ebner - DnaSolution wrote:
Hi, i need help to use interceptor, i create one to test if the user
are logged in my application until he execute one Action, but when
the server pass throw interceptor and back to action, all my var are
null, this is 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="loginClienteAndUsuario"
extends="struts-default">
<interceptors>
<interceptor name="loginUsuario"
class="br.com.dnasolution.site.interceptor.LoginUsuarioInterceptor">
</interceptor>
<interceptor name="loginCliente"
class="br.com.dnasolution.site.interceptor.LoginClienteInterceptor">
</interceptor>
<interceptor-stack name="myStack">
<interceptor-ref name="loginCliente"/>
<interceptor-ref name="loginUsuario"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack"/>
<global-results>
<result name="clienteNaoLogado">/jsp/usuario/loginUsuario.jsp</result>
<result name="clienteNaoLogado">/jsp/cliente/loginCliente.jsp</result>
</global-results>
</package>
</struts>
tks
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.830 / Virus Database: 271.1.1/2998 - Release Date:
07/12/10 03:36:00
---------------------------------------------------------------------
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