You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rahul Patel <rc...@gmail.com> on 2006/11/09 12:36:31 UTC

confused with redirects

Hi All,

I have a very confusing issue at hand that I have been trying to solve for a
couple of days.

I have a Struts-based application where my index.jsp has only one line
<html:redirect forward="welcome"/>

Further, once the user logs in, he is forwarded to applications based on his
feature access. Though, for some reason, when the forward of the action is
complete, somehow ( I put a breakpoint in the RedirectTag) control goes to
index.jsp (or that's what it seems like) and the whole WelcomeAction is
executed on the server side. This happens only on the server side i.e. the
browser is still displaying the page the user had requested. Though, on the
server side, once the page is displayed, control goes to index.jsp as I
said.

The issue is that I perform some session-level initializations at start up
and since index.jsp executes all that code on the server side again,
everything is re-initialized clearing up what the current jsp (that the user
had requested) did.

Any help or direction is appreciated.

Thanks,


Rahul

Re: confused with redirects

Posted by James Mitchell <ja...@mac.com>.
;)  I thought so.


So, all the following are true:
  - you are testing this on your local machine (your browser is  
hitting your own machine)
  - you have enabled cookies on your machine (if not, make sure all  
urls are rewritten correctly, before you click on them)
  - you have a "global" forward named "welcome"
  - "welcome" goes to a jsp page with links that, when clicked,
    will take the user to (for instance) /yourapp/PopulateUserInfo.do
  - you know for a fact that this action is being called because you
     a) added a few print statements
       or
     b) you set a breakpoint and watched the debugger step through it
  - this action returns an ActionForward that will go to UserInfo.jsp
  - you know for a fact that UserInfo.jsp is the path for the  
returned ActionForward because:
     a) added a few print statements
       or
     b) you set a breakpoint and watched the debugger step through it

If you are not hitting your own machine, make sure there isn't a  
proxy or something that might be rewriting the request headers or  
screwing with the cookies in any way.

If all the above are true, make sure:
  - you do not have any filters or listeners intercepting the request  
and changing/wrapping/hijacking/etc

Sorry for the flood of if/else, but without sitting behind you are  
watching what you are doing, this is the best I can offer.

HTH

--
James Mitchell
678.910.8017




On Nov 9, 2006, at 7:08 AM, Rahul Patel wrote:

> I am using Struts 1.1.
> Also, I might have typed in the wrong tag - it is supposed to be
> <logic:redirect>
>
> My index.jsp just has the following line (and the declaration for  
> the tag
> library)
>
> <logic:redirect forward="welcome"/>
>
> I have a menu containing links to forward the user to. e.g. one link
> forwards to an action PopulateUserInfo.do Even though, I am just  
> resetting
> the corresponding form's data in this action and then forwarding to
> UserInfo.jsp, after the entire UserInfo.jsp is loaded, it somehow  
> seems to
> be going to index.jsp. I have this issue for all my *.do actions.
>
> On 11/9/06, James Mitchell <ja...@mac.com> wrote:
>>
>> Please reply with the entire index.jsp content and tell us what
>> version of Struts you are using.  I assume 1.2.x, and so I'm not sure
>> what html:redirect is.
>>
>>
>> --
>> James Mitchell
>> 678.910.8017
>>
>>
>>
>>
>> On Nov 9, 2006, at 6:36 AM, Rahul Patel wrote:
>>
>> > Hi All,
>> >
>> > I have a very confusing issue at hand that I have been trying to
>> > solve for a
>> > couple of days.
>> >
>> > I have a Struts-based application where my index.jsp has only  
>> one line
>> > <html:redirect forward="welcome"/>
>> >
>> > Further, once the user logs in, he is forwarded to applications
>> > based on his
>> > feature access. Though, for some reason, when the forward of the
>> > action is
>> > complete, somehow ( I put a breakpoint in the RedirectTag) control
>> > goes to
>> > index.jsp (or that's what it seems like) and the whole
>> > WelcomeAction is
>> > executed on the server side. This happens only on the server side
>> > i.e. the
>> > browser is still displaying the page the user had requested.
>> > Though, on the
>> > server side, once the page is displayed, control goes to index.jsp
>> > as I
>> > said.
>> >
>> > The issue is that I perform some session-level initializations at
>> > start up
>> > and since index.jsp executes all that code on the server side  
>> again,
>> > everything is re-initialized clearing up what the current jsp (that
>> > the user
>> > had requested) did.
>> >
>> > Any help or direction is appreciated.
>> >
>> > Thanks,
>> >
>> >
>> > Rahul
>>
>>
>> ---------------------------------------------------------------------
>> 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: confused with redirects

Posted by Rahul Patel <rc...@gmail.com>.
I am using Struts 1.1.
Also, I might have typed in the wrong tag - it is supposed to be
<logic:redirect>

My index.jsp just has the following line (and the declaration for the tag
library)

<logic:redirect forward="welcome"/>

I have a menu containing links to forward the user to. e.g. one link
forwards to an action PopulateUserInfo.do Even though, I am just resetting
the corresponding form's data in this action and then forwarding to
UserInfo.jsp, after the entire UserInfo.jsp is loaded, it somehow seems to
be going to index.jsp. I have this issue for all my *.do actions.

On 11/9/06, James Mitchell <ja...@mac.com> wrote:
>
> Please reply with the entire index.jsp content and tell us what
> version of Struts you are using.  I assume 1.2.x, and so I'm not sure
> what html:redirect is.
>
>
> --
> James Mitchell
> 678.910.8017
>
>
>
>
> On Nov 9, 2006, at 6:36 AM, Rahul Patel wrote:
>
> > Hi All,
> >
> > I have a very confusing issue at hand that I have been trying to
> > solve for a
> > couple of days.
> >
> > I have a Struts-based application where my index.jsp has only one line
> > <html:redirect forward="welcome"/>
> >
> > Further, once the user logs in, he is forwarded to applications
> > based on his
> > feature access. Though, for some reason, when the forward of the
> > action is
> > complete, somehow ( I put a breakpoint in the RedirectTag) control
> > goes to
> > index.jsp (or that's what it seems like) and the whole
> > WelcomeAction is
> > executed on the server side. This happens only on the server side
> > i.e. the
> > browser is still displaying the page the user had requested.
> > Though, on the
> > server side, once the page is displayed, control goes to index.jsp
> > as I
> > said.
> >
> > The issue is that I perform some session-level initializations at
> > start up
> > and since index.jsp executes all that code on the server side again,
> > everything is re-initialized clearing up what the current jsp (that
> > the user
> > had requested) did.
> >
> > Any help or direction is appreciated.
> >
> > Thanks,
> >
> >
> > Rahul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: confused with redirects

Posted by James Mitchell <ja...@mac.com>.
Please reply with the entire index.jsp content and tell us what  
version of Struts you are using.  I assume 1.2.x, and so I'm not sure  
what html:redirect is.


--
James Mitchell
678.910.8017




On Nov 9, 2006, at 6:36 AM, Rahul Patel wrote:

> Hi All,
>
> I have a very confusing issue at hand that I have been trying to  
> solve for a
> couple of days.
>
> I have a Struts-based application where my index.jsp has only one line
> <html:redirect forward="welcome"/>
>
> Further, once the user logs in, he is forwarded to applications  
> based on his
> feature access. Though, for some reason, when the forward of the  
> action is
> complete, somehow ( I put a breakpoint in the RedirectTag) control  
> goes to
> index.jsp (or that's what it seems like) and the whole  
> WelcomeAction is
> executed on the server side. This happens only on the server side  
> i.e. the
> browser is still displaying the page the user had requested.  
> Though, on the
> server side, once the page is displayed, control goes to index.jsp  
> as I
> said.
>
> The issue is that I perform some session-level initializations at  
> start up
> and since index.jsp executes all that code on the server side again,
> everything is re-initialized clearing up what the current jsp (that  
> the user
> had requested) did.
>
> Any help or direction is appreciated.
>
> Thanks,
>
>
> Rahul


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