You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ramon <ra...@gmail.com> on 2008/06/15 19:14:40 UTC

Adding interceptors through annotations

Hi,

I'm starting with a little project to test new features in struts2. I'm
trying both ways (xml configuration and annotations) but I don't know how to
define interceptors for an action which is defined with interceptors. for a
example my action looks like this:


@Results({
    @Result(value="/jsp/menu.jsp" )})
public class MenuAction{

    public String execute() throws Exception {
        return "success";
    }
}

Know, I thoigut it would be an annotation to define interceptors for this
Action, but I haven't found anything. Does anyone know how to do it???

Have Fun ;)

Re: Adding interceptors through annotations

Posted by Ramon <ra...@gmail.com>.
Thanks for the idea, I'm going to try it now ;)


2008/6/16 Gamble, Wesley (WG10) <WG...@tmw.com>:

> Dave is correct, you can configure your interceptors with XML and then
> define @ParentPackage in your annotations to point to the name of your
> Struts package.
>
> -----Original Message-----
> From: Dave Newton [mailto:newton.dave@yahoo.com]
> Sent: Sunday, June 15, 2008 1:23 PM
> To: Struts Users Mailing List
> Subject: Re: Adding interceptors through annotations
>
> You don't, but this functionality may have been added to S2.1 (don't
> quote me on that; I'm woefully behind, but I know it has been
> discussed.)
>
> One typical solution is to define a package's interceptors via XML then
> use the @ParentPackage annotation to configure your actions.
>
> Dave
>
> --- On Sun, 6/15/08, Ramon <ra...@gmail.com> wrote:
>
> > From: Ramon <ra...@gmail.com>
> > Subject: Re: Adding interceptors through annotations
> > To: user@struts.apache.org
> > Date: Sunday, June 15, 2008, 2:04 PM
> > Uff I wrote it so badly,
> >
> > Summary:
> >     Does anyone know how to add interceptors to an Action
> > defined with
> > annotations (without definitiion in an xml file)???
> >
> >
> >
> > 2008/6/15 Ramon <ra...@gmail.com>:
> >
> > > Hi,
> > >
> > > I'm starting with a little project to test new
> > features in struts2. I'm
> > > trying both ways (xml configuration and annotations)
> > but I don't know how to
> > > define interceptors for an action which is defined
> > with interceptors. for a
> > > example my action looks like this:
> > >
> > >
> > > @Results({
> > >     @Result(value="/jsp/menu.jsp" )})
> > > public class MenuAction{
> > >
> > >     public String execute() throws Exception {
> > >         return "success";
> > >     }
> > > }
> > >
> > > Know, I thoigut it would be an annotation to define
> > interceptors for this
> > > Action, but I haven't found anything. Does anyone
> > know how to do it???
> > >
> > > Have Fun ;)
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Adding interceptors through annotations

Posted by "Gamble, Wesley (WG10)" <WG...@tmw.com>.
Dave is correct, you can configure your interceptors with XML and then 
define @ParentPackage in your annotations to point to the name of your
Struts package.

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Sunday, June 15, 2008 1:23 PM
To: Struts Users Mailing List
Subject: Re: Adding interceptors through annotations

You don't, but this functionality may have been added to S2.1 (don't
quote me on that; I'm woefully behind, but I know it has been
discussed.)

One typical solution is to define a package's interceptors via XML then
use the @ParentPackage annotation to configure your actions.

Dave

--- On Sun, 6/15/08, Ramon <ra...@gmail.com> wrote:

> From: Ramon <ra...@gmail.com>
> Subject: Re: Adding interceptors through annotations
> To: user@struts.apache.org
> Date: Sunday, June 15, 2008, 2:04 PM
> Uff I wrote it so badly,
> 
> Summary:
>     Does anyone know how to add interceptors to an Action
> defined with
> annotations (without definitiion in an xml file)???
> 
> 
> 
> 2008/6/15 Ramon <ra...@gmail.com>:
> 
> > Hi,
> >
> > I'm starting with a little project to test new
> features in struts2. I'm
> > trying both ways (xml configuration and annotations)
> but I don't know how to
> > define interceptors for an action which is defined
> with interceptors. for a
> > example my action looks like this:
> >
> >
> > @Results({
> >     @Result(value="/jsp/menu.jsp" )})
> > public class MenuAction{
> >
> >     public String execute() throws Exception {
> >         return "success";
> >     }
> > }
> >
> > Know, I thoigut it would be an annotation to define
> interceptors for this
> > Action, but I haven't found anything. Does anyone
> know how to do it???
> >
> > Have Fun ;)
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Adding interceptors through annotations

Posted by Dave Newton <ne...@yahoo.com>.
You don't, but this functionality may have been added to S2.1 (don't quote me on that; I'm woefully behind, but I know it has been discussed.)

One typical solution is to define a package's interceptors via XML then use the @ParentPackage annotation to configure your actions.

Dave

--- On Sun, 6/15/08, Ramon <ra...@gmail.com> wrote:

> From: Ramon <ra...@gmail.com>
> Subject: Re: Adding interceptors through annotations
> To: user@struts.apache.org
> Date: Sunday, June 15, 2008, 2:04 PM
> Uff I wrote it so badly,
> 
> Summary:
>     Does anyone know how to add interceptors to an Action
> defined with
> annotations (without definitiion in an xml file)???
> 
> 
> 
> 2008/6/15 Ramon <ra...@gmail.com>:
> 
> > Hi,
> >
> > I'm starting with a little project to test new
> features in struts2. I'm
> > trying both ways (xml configuration and annotations)
> but I don't know how to
> > define interceptors for an action which is defined
> with interceptors. for a
> > example my action looks like this:
> >
> >
> > @Results({
> >     @Result(value="/jsp/menu.jsp" )})
> > public class MenuAction{
> >
> >     public String execute() throws Exception {
> >         return "success";
> >     }
> > }
> >
> > Know, I thoigut it would be an annotation to define
> interceptors for this
> > Action, but I haven't found anything. Does anyone
> know how to do it???
> >
> > Have Fun ;)
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Adding interceptors through annotations

Posted by Ramon <ra...@gmail.com>.
Uff I wrote it so badly,

Summary:
    Does anyone know how to add interceptors to an Action defined with
annotations (without definitiion in an xml file)???



2008/6/15 Ramon <ra...@gmail.com>:

> Hi,
>
> I'm starting with a little project to test new features in struts2. I'm
> trying both ways (xml configuration and annotations) but I don't know how to
> define interceptors for an action which is defined with interceptors. for a
> example my action looks like this:
>
>
> @Results({
>     @Result(value="/jsp/menu.jsp" )})
> public class MenuAction{
>
>     public String execute() throws Exception {
>         return "success";
>     }
> }
>
> Know, I thoigut it would be an annotation to define interceptors for this
> Action, but I haven't found anything. Does anyone know how to do it???
>
> Have Fun ;)
>