Read the section on the config file elements in struts.xml on the Struts2 docs site. Also read the Interceptors guide[1].

You have to specify the interceptor stack on the action. You can use the <default-interceptor-ref> element to specify what stack to use by default.

And what you've defined is not an interceptor stack - it's just an interceptor alone. What you want to do is specify something like this:

<interceptors>
<interceptor name="adminLogin" class="com.mycompany.myproduct.AdminInterceptor"/>
        <interceptor-stack name="adminStack">
                <interceptor-ref name="defaultStack"/>
                <interceptor-ref name="adminLogin"/>
        </interceptor-stack>
</interceptors>

That adds the admin interceptor to the bottom of the basic interceptor stack.

Look at the docs - you'll get a faster answer than coming to the mailing list with every question. They really are very good docs, as docs go.

Andy.

[1] http://struts.apache.org/2.x/docs/interceptors.html

On 21 May 2009, at 16:00, Stefano Tranquillini wrote:

thanks,

but i definide in struts my interceptors in this way:

<package name="admin" extends="default" namespace="/admin">
      <interceptors>
<interceptor name="adminLogin" class="interceptors.AdminLogin"/>
      </interceptors>

in order to use the interceptors only when namespace is /admin/*

but the interceptor is never called!

And:


where i've to put the globalforward?
i putted a the end of the sturts.xml

something like that

 <global-forwards>
       <forward name="denied" path="/deniedShow.action"/>
   </global-forwards>

has to be inside package or something else?

the error is:

2009-05-21 16:56:51,171 ERROR [com.opensymphony.xwork2.util.DomHelper]
(HDScanner) Element type "global-forwards" must be declared. at
(null:92:22)
org.xml.sax.SAXParseException: Element type "global-forwards" must be declared.



2009/5/21 Stefano <elste...@gmail.com>:
2009/5/21 Paweł Wielgus <poulw...@gmail.com>:
global forward

thanks,

but i definide in struts my interceptors in this way:

 <package name="admin" extends="default" namespace="/admin">
       <interceptors>
<interceptor name="adminLogin" class="interceptors.AdminLogin"/>
       </interceptors>

in order to use the interceptors only when namespace is /admin/*

but the interceptor is never called!

ideas?

thanks

--
Stefano




--
Stefano

---------------------------------------------------------------------
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

Reply via email to