Geeta:
It looks a little complicated. I tried request.getRequestURL()(or getRequestURI).
It doesnot work out. let me illustrate it using an example:
there is such a line in "whatever.jsp":
<META HTTP-EQUIV=refresh CONTENT="30; URL=/relative_path/redirect.do">
here the redirect.do action class make the judgement and decide whether forward to another link or stay at previous page. but the problem is the getRequestURL() in
Redirect Action returns "relative_path/redirect", not the "whatever.jsp" something. and more if I simply forward page back to "whatever.jsp",there are errors, Because in
my struts application, all jsps are generated from some action.do class, which do some
logic operation,database operaion,etc. So it really baffle me.
But I find if the redirect can know the previous request path and forward to there, that is what I want. That means if whatever.jsp comes from "relative_path/preaction.do",
which actually is displayed in the browser's address area, and redirect action can forward
to there. It will really work. But it seems very difficult to find them in action. I thought it's just a simple function. But didn't know it became so difficult here. Could you have some alternative solution? Thanks.
Regards
Alex
yourFrom: "Geeta Ramani" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: how to implement such an action? Date: Wed, 17 Mar 2004 11:19:16 -0500
Alex:
Here's an easy way to implement this: Have a hidden variable in each of
jsps which reflects the name of the jsp you are on and use that in youraction
class to prepare the forward (do you see what i'm saying..? I canelaborate if
you'd like..) . You could also use something like request.getRequestURL()(I
think this is right..look in the API to be sure..) if you don't want touse
hidden variables..pages.
Hope this helps, Geeta
chiu alex wrote:
> Geeta:
> Yes, that's the point.This refresh action need to exist in many
> looks like it is easy to implement if it can just do a back operationin
> that action class when false return. But actually as I know the actionand
> doesnot provide such operation. So do you have some idea about this?
>
> Regards,
> Alex
>
> >From: "Geeta Ramani" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >Subject: Re: how to implement such an action?
> >Date: Wed, 17 Mar 2004 07:16:00 -0500
> >
> >Alex:
> >
> >Your initial page is just a jsp, right? So why would you not use your
> action
> >mapping to say something like if "success then forward to newpage.jsp
> ifthis
> >not forward to samePage.jsp"..? This will work unless you are using
> >refresh action in many pages..? In which case, you will have to"remember
> themay
> >page" - and that can be done - but if the simpler solution works, that
> besee no
> >best, especially since you say you are a newbie..:)
> >
> >Please ignore this note if you have already received emails about your
> >question: our mail server has been *really* slow recently and I can
> >replies to your question yet..by
> >
> >Regards,
> >Geeta
> >
> >chiu alex wrote:
> >
> > > Hello,everyone,
> > >
> > > I want to implement such an action which is actually activated
> > > within the meta:refresh tag. (that means it will be called every 30it
> > > seconds). What the action need to do is to make some judgements. If
> getprevious
> > > true result, it forward to another page, or else it stays at
> pageto
> > > and do nothing, so user will see no change. Obviously, action need
> > > remember that page, but I do not know how to put it. I am just anewbie
> in---------------------------------------------------------------------
> > > struts.
> > > So could you kindly give me some clue to it. Thanks!
> > >
> > > Alex
> > >
> > > _________________________________________________________________
> > > 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
> > >
> > >
> > > To unsubscribe, e-mail: [EMAIL PROTECTED][EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _________________________________________________________________ > 免费下载 MSN Explorer: http://explorer.msn.com/lccn > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]