You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Murugesh <mu...@gmail.com> on 2009/05/12 12:54:46 UTC

unable to get the request parameters

 I am doing task on struts2. In that I have to use custom
AutherizationInterceptor. In my custom Interceptor Im checking weather user
is in session or not. And if he tries to attempt login I gave parameter in
struts.xml as true So Im checking against it and interceptor redirects
action to Home. But my problem is unable to get the request parameters in
Any Action class if Session exist too.

please help on this issue.

Re: unable to get the request parameters

Posted by Murugesh <mu...@gmail.com>.
Thanks a lot..

 i have changed my config of interceptors as

<interceptors>
            <interceptor name="login"
class="com.amr.controller.action.generic.logininterceptor"/>
            <interceptor-stack name="loginStack">
                <interceptor-ref name="login"/>
                <interceptor-ref name="defaultStack"/>
            </interceptor-stack>
        </interceptors>
        <default-interceptor-ref name="loginStack"/>

now its working fine.i will do unit test completely and update soon.

On Tue, May 12, 2009 at 5:22 PM, Nils-Helge Garli Hegvik
<ni...@gmail.com>wrote:

> Here's an example:
> http://struts.apache.org/2.1.6/docs/interceptor-configuration.html
>
> Note how a custom stack is defined and how the custom stack is
> referring to the "defaultStack".
>
> Nils-H
>
> On Tue, May 12, 2009 at 1:33 PM, Murugesh <mu...@gmail.com> wrote:
> > and also am very new to Interceptors
> >
> > On Tue, May 12, 2009 at 5:00 PM, Murugesh <mu...@gmail.com> wrote:
> >
> >> Thanks Nils-H.
> >>
> >> i am not clear. can i have the sample for this?
> >>
> >>   On Tue, May 12, 2009 at 4:57 PM, Nils-Helge Garli Hegvik <
> >> nilsga@gmail.com> wrote:
> >>
> >>> You have configured your interceptor as the only one in the stack.
> >>> When you create your own interceptor stack, make sure you also include
> >>> one of the framework stacks (e.g. basicStack).
> >>>
> >>> Nils-H
> >>>
> >>> On Tue, May 12, 2009 at 1:04 PM, Murugesh <mu...@gmail.com>
> wrote:
> >>> > <struts>
> >>> >    <package name="packet" extends="struts-default" namespace="/">
> >>> >        <interceptors>
> >>> >            <interceptor name="login"
> >>> > class="com.action.generic.logininterceptor"/>
> >>> >        </interceptors>
> >>> >       <default-interceptor-ref name="login"/>
> >>> >       <global-results>
> >>> >            <result name="error">/login.jsp</result>
> >>> >        </global-results>
> >>> >       <action name="showData"
> >>> class="com.action.device.ManagePacketsAction"
> >>> > method="show30MData">
> >>> > <result>/data.jsp</result>
> >>> > </action>
> >>> >
> >>> > I am have default interceptor named login. i am chking session
> >>> validation
> >>> > (like is user loggin r not ). it seems work but after running
> >>>  interceptor
> >>> > it backs to actionclass, here i am chking requset parameters  at that
> am
> >>> > geeting for all parameters.
> >>> >
> >>> > Without interceptor everything working fine.
> >>> >
> >>> >
> >>> >
> >>> > On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
> >>> > <ni...@gmail.com>wrote:
> >>> >
> >>> >> It would certainly be a lot easier to help if you could show your
> >>> >> configuration and code...
> >>> >>
> >>> >> Nils-H
> >>> >>
> >>> >> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com>
> >>> wrote:
> >>> >> >  I am doing task on struts2. In that I have to use custom
> >>> >> > AutherizationInterceptor. In my custom Interceptor Im checking
> >>> weather
> >>> >> user
> >>> >> > is in session or not. And if he tries to attempt login I gave
> >>> parameter
> >>> >> in
> >>> >> > struts.xml as true So Im checking against it and interceptor
> >>> redirects
> >>> >> > action to Home. But my problem is unable to get the request
> >>> parameters in
> >>> >> > Any Action class if Session exist too.
> >>> >> >
> >>> >> > please help on this issue.
> >>> >> >
> >>> >>
> >>> >>
> ---------------------------------------------------------------------
> >>> >> 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
> >>>
> >>>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: unable to get the request parameters

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Here's an example:
http://struts.apache.org/2.1.6/docs/interceptor-configuration.html

Note how a custom stack is defined and how the custom stack is
referring to the "defaultStack".

Nils-H

On Tue, May 12, 2009 at 1:33 PM, Murugesh <mu...@gmail.com> wrote:
> and also am very new to Interceptors
>
> On Tue, May 12, 2009 at 5:00 PM, Murugesh <mu...@gmail.com> wrote:
>
>> Thanks Nils-H.
>>
>> i am not clear. can i have the sample for this?
>>
>>   On Tue, May 12, 2009 at 4:57 PM, Nils-Helge Garli Hegvik <
>> nilsga@gmail.com> wrote:
>>
>>> You have configured your interceptor as the only one in the stack.
>>> When you create your own interceptor stack, make sure you also include
>>> one of the framework stacks (e.g. basicStack).
>>>
>>> Nils-H
>>>
>>> On Tue, May 12, 2009 at 1:04 PM, Murugesh <mu...@gmail.com> wrote:
>>> > <struts>
>>> >    <package name="packet" extends="struts-default" namespace="/">
>>> >        <interceptors>
>>> >            <interceptor name="login"
>>> > class="com.action.generic.logininterceptor"/>
>>> >        </interceptors>
>>> >       <default-interceptor-ref name="login"/>
>>> >       <global-results>
>>> >            <result name="error">/login.jsp</result>
>>> >        </global-results>
>>> >       <action name="showData"
>>> class="com.action.device.ManagePacketsAction"
>>> > method="show30MData">
>>> > <result>/data.jsp</result>
>>> > </action>
>>> >
>>> > I am have default interceptor named login. i am chking session
>>> validation
>>> > (like is user loggin r not ). it seems work but after running
>>>  interceptor
>>> > it backs to actionclass, here i am chking requset parameters  at that am
>>> > geeting for all parameters.
>>> >
>>> > Without interceptor everything working fine.
>>> >
>>> >
>>> >
>>> > On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
>>> > <ni...@gmail.com>wrote:
>>> >
>>> >> It would certainly be a lot easier to help if you could show your
>>> >> configuration and code...
>>> >>
>>> >> Nils-H
>>> >>
>>> >> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com>
>>> wrote:
>>> >> >  I am doing task on struts2. In that I have to use custom
>>> >> > AutherizationInterceptor. In my custom Interceptor Im checking
>>> weather
>>> >> user
>>> >> > is in session or not. And if he tries to attempt login I gave
>>> parameter
>>> >> in
>>> >> > struts.xml as true So Im checking against it and interceptor
>>> redirects
>>> >> > action to Home. But my problem is unable to get the request
>>> parameters in
>>> >> > Any Action class if Session exist too.
>>> >> >
>>> >> > please help on this issue.
>>> >> >
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> 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
>>>
>>>
>>
>

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


Re: unable to get the request parameters

Posted by Murugesh <mu...@gmail.com>.
and also am very new to Interceptors

On Tue, May 12, 2009 at 5:00 PM, Murugesh <mu...@gmail.com> wrote:

> Thanks Nils-H.
>
> i am not clear. can i have the sample for this?
>
>   On Tue, May 12, 2009 at 4:57 PM, Nils-Helge Garli Hegvik <
> nilsga@gmail.com> wrote:
>
>> You have configured your interceptor as the only one in the stack.
>> When you create your own interceptor stack, make sure you also include
>> one of the framework stacks (e.g. basicStack).
>>
>> Nils-H
>>
>> On Tue, May 12, 2009 at 1:04 PM, Murugesh <mu...@gmail.com> wrote:
>> > <struts>
>> >    <package name="packet" extends="struts-default" namespace="/">
>> >        <interceptors>
>> >            <interceptor name="login"
>> > class="com.action.generic.logininterceptor"/>
>> >        </interceptors>
>> >       <default-interceptor-ref name="login"/>
>> >       <global-results>
>> >            <result name="error">/login.jsp</result>
>> >        </global-results>
>> >       <action name="showData"
>> class="com.action.device.ManagePacketsAction"
>> > method="show30MData">
>> > <result>/data.jsp</result>
>> > </action>
>> >
>> > I am have default interceptor named login. i am chking session
>> validation
>> > (like is user loggin r not ). it seems work but after running
>>  interceptor
>> > it backs to actionclass, here i am chking requset parameters  at that am
>> > geeting for all parameters.
>> >
>> > Without interceptor everything working fine.
>> >
>> >
>> >
>> > On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
>> > <ni...@gmail.com>wrote:
>> >
>> >> It would certainly be a lot easier to help if you could show your
>> >> configuration and code...
>> >>
>> >> Nils-H
>> >>
>> >> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com>
>> wrote:
>> >> >  I am doing task on struts2. In that I have to use custom
>> >> > AutherizationInterceptor. In my custom Interceptor Im checking
>> weather
>> >> user
>> >> > is in session or not. And if he tries to attempt login I gave
>> parameter
>> >> in
>> >> > struts.xml as true So Im checking against it and interceptor
>> redirects
>> >> > action to Home. But my problem is unable to get the request
>> parameters in
>> >> > Any Action class if Session exist too.
>> >> >
>> >> > please help on this issue.
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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: unable to get the request parameters

Posted by Murugesh <mu...@gmail.com>.
Thanks Nils-H.

i am not clear. can i have the sample for this?

On Tue, May 12, 2009 at 4:57 PM, Nils-Helge Garli Hegvik
<ni...@gmail.com>wrote:

> You have configured your interceptor as the only one in the stack.
> When you create your own interceptor stack, make sure you also include
> one of the framework stacks (e.g. basicStack).
>
> Nils-H
>
> On Tue, May 12, 2009 at 1:04 PM, Murugesh <mu...@gmail.com> wrote:
> > <struts>
> >    <package name="packet" extends="struts-default" namespace="/">
> >        <interceptors>
> >            <interceptor name="login"
> > class="com.action.generic.logininterceptor"/>
> >        </interceptors>
> >       <default-interceptor-ref name="login"/>
> >       <global-results>
> >            <result name="error">/login.jsp</result>
> >        </global-results>
> >       <action name="showData"
> class="com.action.device.ManagePacketsAction"
> > method="show30MData">
> > <result>/data.jsp</result>
> > </action>
> >
> > I am have default interceptor named login. i am chking session validation
> > (like is user loggin r not ). it seems work but after running
>  interceptor
> > it backs to actionclass, here i am chking requset parameters  at that am
> > geeting for all parameters.
> >
> > Without interceptor everything working fine.
> >
> >
> >
> > On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
> > <ni...@gmail.com>wrote:
> >
> >> It would certainly be a lot easier to help if you could show your
> >> configuration and code...
> >>
> >> Nils-H
> >>
> >> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com>
> wrote:
> >> >  I am doing task on struts2. In that I have to use custom
> >> > AutherizationInterceptor. In my custom Interceptor Im checking weather
> >> user
> >> > is in session or not. And if he tries to attempt login I gave
> parameter
> >> in
> >> > struts.xml as true So Im checking against it and interceptor redirects
> >> > action to Home. But my problem is unable to get the request parameters
> in
> >> > Any Action class if Session exist too.
> >> >
> >> > please help on this issue.
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> 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: unable to get the request parameters

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
You have configured your interceptor as the only one in the stack.
When you create your own interceptor stack, make sure you also include
one of the framework stacks (e.g. basicStack).

Nils-H

On Tue, May 12, 2009 at 1:04 PM, Murugesh <mu...@gmail.com> wrote:
> <struts>
>    <package name="packet" extends="struts-default" namespace="/">
>        <interceptors>
>            <interceptor name="login"
> class="com.action.generic.logininterceptor"/>
>        </interceptors>
>       <default-interceptor-ref name="login"/>
>       <global-results>
>            <result name="error">/login.jsp</result>
>        </global-results>
>       <action name="showData" class="com.action.device.ManagePacketsAction"
> method="show30MData">
> <result>/data.jsp</result>
> </action>
>
> I am have default interceptor named login. i am chking session validation
> (like is user loggin r not ). it seems work but after running  interceptor
> it backs to actionclass, here i am chking requset parameters  at that am
> geeting for all parameters.
>
> Without interceptor everything working fine.
>
>
>
> On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
> <ni...@gmail.com>wrote:
>
>> It would certainly be a lot easier to help if you could show your
>> configuration and code...
>>
>> Nils-H
>>
>> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com> wrote:
>> >  I am doing task on struts2. In that I have to use custom
>> > AutherizationInterceptor. In my custom Interceptor Im checking weather
>> user
>> > is in session or not. And if he tries to attempt login I gave parameter
>> in
>> > struts.xml as true So Im checking against it and interceptor redirects
>> > action to Home. But my problem is unable to get the request parameters in
>> > Any Action class if Session exist too.
>> >
>> > please help on this issue.
>> >
>>
>> ---------------------------------------------------------------------
>> 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: unable to get the request parameters

Posted by Murugesh <mu...@gmail.com>.
and my logininterceptor is
public class logininterceptor extends AbstractInterceptor  {
   private static final String USER_KEY = "isLoggedin";
 public String intercept(ActionInvocation invocation) throws Exception {
  Map session = invocation.getInvocationContext().getSession();
        System.out.println(" calling intercep"+invocation.getAction());
  if(session.get(USER_KEY) == null) {
             System.out.println(" Not logged in");
   //addActionError(invocation, "You must be authenticated to access this
page");
   return Action.ERROR;
  }
        System.out.println("Hey he already logged in");

  return invocation.invoke();
 }


On Tue, May 12, 2009 at 4:34 PM, Murugesh <mu...@gmail.com> wrote:

> <struts>
>     <package name="packet" extends="struts-default" namespace="/">
>         <interceptors>
>             <interceptor name="login"
> class="com.action.generic.logininterceptor"/>
>         </interceptors>
>        <default-interceptor-ref name="login"/>
>        <global-results>
>             <result name="error">/login.jsp</result>
>         </global-results>
>        <action name="showData"
> class="com.action.device.ManagePacketsAction" method="show30MData">
> <result>/data.jsp</result>
> </action>
>
> I am have default interceptor named login. i am chking session validation
> (like is user loggin r not ). it seems work but after running  interceptor
> it backs to actionclass, here i am chking requset parameters  at that am
> geeting for all parameters.
>
> Without interceptor everything working fine.
>
>
>
> On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik <nilsga@gmail.com
> > wrote:
>
>> It would certainly be a lot easier to help if you could show your
>> configuration and code...
>>
>> Nils-H
>>
>> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com> wrote:
>> >  I am doing task on struts2. In that I have to use custom
>> > AutherizationInterceptor. In my custom Interceptor Im checking weather
>> user
>> > is in session or not. And if he tries to attempt login I gave parameter
>> in
>> > struts.xml as true So Im checking against it and interceptor redirects
>> > action to Home. But my problem is unable to get the request parameters
>> in
>> > Any Action class if Session exist too.
>> >
>> > please help on this issue.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: unable to get the request parameters

Posted by Murugesh <mu...@gmail.com>.
<struts>
    <package name="packet" extends="struts-default" namespace="/">
        <interceptors>
            <interceptor name="login"
class="com.action.generic.logininterceptor"/>
        </interceptors>
       <default-interceptor-ref name="login"/>
       <global-results>
            <result name="error">/login.jsp</result>
        </global-results>
       <action name="showData" class="com.action.device.ManagePacketsAction"
method="show30MData">
<result>/data.jsp</result>
</action>

I am have default interceptor named login. i am chking session validation
(like is user loggin r not ). it seems work but after running  interceptor
it backs to actionclass, here i am chking requset parameters  at that am
geeting for all parameters.

Without interceptor everything working fine.



On Tue, May 12, 2009 at 4:27 PM, Nils-Helge Garli Hegvik
<ni...@gmail.com>wrote:

> It would certainly be a lot easier to help if you could show your
> configuration and code...
>
> Nils-H
>
> On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com> wrote:
> >  I am doing task on struts2. In that I have to use custom
> > AutherizationInterceptor. In my custom Interceptor Im checking weather
> user
> > is in session or not. And if he tries to attempt login I gave parameter
> in
> > struts.xml as true So Im checking against it and interceptor redirects
> > action to Home. But my problem is unable to get the request parameters in
> > Any Action class if Session exist too.
> >
> > please help on this issue.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: unable to get the request parameters

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
It would certainly be a lot easier to help if you could show your
configuration and code...

Nils-H

On Tue, May 12, 2009 at 12:54 PM, Murugesh <mu...@gmail.com> wrote:
>  I am doing task on struts2. In that I have to use custom
> AutherizationInterceptor. In my custom Interceptor Im checking weather user
> is in session or not. And if he tries to attempt login I gave parameter in
> struts.xml as true So Im checking against it and interceptor redirects
> action to Home. But my problem is unable to get the request parameters in
> Any Action class if Session exist too.
>
> please help on this issue.
>

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