You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Letícia Álvares Barbalho <le...@gmail.com> on 2005/08/25 19:05:01 UTC

Forwarding to the same page - newbie question

 Hello everyone. I know it's a totally noob question, but I gotta ask. 

I have an action that is called from page.jsp. After it's executed, it is 
forwarded to the same page: page.jsp. But the problem is that it reloads the 
same page with all the data that was there before. And I wanna reload it 
blank, with nothing. Is there a struts way to do it? 'Cause I'd rather not 
use JS... 

is there something wrong with this:

<action
path="/AddColecao"
type="auge.action.AddColecaoAction"
name="addColecaoForm" 
scope="request" 
validate="true"
input="/pages/colecao.jsp"> 
<forward name="success" path="/pages/colecao.jsp"/> 
<forward name="error" path="/pages/erro.jsp"/> 
</action> 

as you see, the input and the "success" forward, which I call, are the same.

-- 

Letícia Álvares Barbalho
leticia.barbalho@gmail.com

Re: Forwarding to the same page - newbie question

Posted by Michael Jouravlev <jm...@gmail.com>.
It won't help you next time when you decide to *keep* the content
instead of just displaying empty page. Also, accessing JSP directly
(which you do by using redirection... no pun intended) is frowned
upon.

Instead of using feature-challenged DispatchAction, next time you
might want to try DialogAction:
http://struts.sourceforge.net/strutsdialogs/#dialogaction
In that case you would redirect to the *same action*, which would
display the page.

--
Struts Dialogs
http://struts.sourceforge.net/strutsdialogs

Michael.

On 8/25/05, Letícia Álvares Barbalho <le...@gmail.com> wrote:
> thank you Martin... the tip I got from Gary solved the problem.
> Just had to put a redirect="true" in my forward tag.
> Thanks
> 
> On 8/25/05, Martin Gainty <mg...@hotmail.com> wrote:
> >
> > Can be solved a couple of different ways
> > populating a hidden form field and testing the value of the hidden form
> > field OR
> > switching on DispatchAction (one for save, one for submit, one for create)
> > Take a look at Ted Husted's response to the question at
> > http://www.jguru.com/faq/view.jsp?EID=897290
> >
> > Martin-

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


Re: Forwarding to the same page - newbie question

Posted by Letícia Álvares Barbalho <le...@gmail.com>.
thank you Martin... the tip I got from Gary solved the problem.
Just had to put a redirect="true" in my forward tag.
Thanks

On 8/25/05, Martin Gainty <mg...@hotmail.com> wrote:
> 
> Can be solved a couple of different ways
> populating a hidden form field and testing the value of the hidden form
> field OR
> switching on DispatchAction (one for save, one for submit, one for create)
> Take a look at Ted Husted's response to the question at
> http://www.jguru.com/faq/view.jsp?EID=897290
> 
> Martin-
> 
> ----- Original Message -----
> From: "Letícia Álvares Barbalho" <le...@gmail.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Thursday, August 25, 2005 1:05 PM
> Subject: Forwarding to the same page - newbie question
> 
> 
> Hello everyone. I know it's a totally noob question, but I gotta ask.
> 
> I have an action that is called from page.jsp. After it's executed, it is
> forwarded to the same page: page.jsp. But the problem is that it reloads 
> the
> same page with all the data that was there before. And I wanna reload it
> blank, with nothing. Is there a struts way to do it? 'Cause I'd rather not
> use JS...
> 
> is there something wrong with this:
> 
> <action
> path="/AddColecao"
> type="auge.action.AddColecaoAction"
> name="addColecaoForm"
> scope="request"
> validate="true"
> input="/pages/colecao.jsp">
> <forward name="success" path="/pages/colecao.jsp"/>
> <forward name="error" path="/pages/erro.jsp"/>
> </action>
> 
> as you see, the input and the "success" forward, which I call, are the 
> same.
> 
> --
> 
> Letícia Álvares Barbalho
> leticia.barbalho@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
Letícia Álvares Barbalho
leticia.barbalho@gmail.com

Re: Forwarding to the same page - newbie question

Posted by Martin Gainty <mg...@hotmail.com>.
Can be solved a couple of different ways
populating a hidden form field and testing the value of the hidden form 
field OR
switching on DispatchAction (one for save, one for submit, one for create)
Take a look at Ted Husted's response to the question at
http://www.jguru.com/faq/view.jsp?EID=897290

Martin-

----- Original Message ----- 
From: "Letícia Álvares Barbalho" <le...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, August 25, 2005 1:05 PM
Subject: Forwarding to the same page - newbie question


Hello everyone. I know it's a totally noob question, but I gotta ask.

I have an action that is called from page.jsp. After it's executed, it is
forwarded to the same page: page.jsp. But the problem is that it reloads the
same page with all the data that was there before. And I wanna reload it
blank, with nothing. Is there a struts way to do it? 'Cause I'd rather not
use JS...

is there something wrong with this:

<action
path="/AddColecao"
type="auge.action.AddColecaoAction"
name="addColecaoForm"
scope="request"
validate="true"
input="/pages/colecao.jsp">
<forward name="success" path="/pages/colecao.jsp"/>
<forward name="error" path="/pages/erro.jsp"/>
</action>

as you see, the input and the "success" forward, which I call, are the same.

-- 

Letícia Álvares Barbalho
leticia.barbalho@gmail.com

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