You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by as...@gmx.de on 2003/08/06 09:26:18 UTC

Still struggeling: howto get ActionForward to calling page

Hi, 

i am still looking for a clean way to get an ActionForward to the page that called my 
current Action. That means e.g. I am a displayListAction and have been called by a 
selection screen. In case i don't find a result for the selection parameters I would like to 
bring a specific error to the calling selection screen. That would give users a chance to 
change their selection. 

Sounding easy, this gets complicate in case there are several selection screens 
bringing up the same list. I don't like to create a specific forward for each selection page 
and then somehow determine which one called me (can do that, but there should be a 
nice way in such a famous framework?). 

The hint using 
	ActionMapping.getInputForward()
	or new ActionForward(mapping.getInput())
didn't help me to much, seems to me there is hardcoded value inside, specified in the 
input attribute of the specific action.

How would an expert solve that problem?

 :-) Alex



>Looking for a way to get an ActionForward to the page calling the 
>current page. 
>
>The example: 
>Want to realize 5-XX pages where to enter values for a 
>calculation. The calculation & result page would check if 
>everything was fine (using db queries etc..)
>Now in case that one of the input values is incorrect / 
>missmatching the context, I'd like to redisplay the calling page 
>showing the values entered before + an error message. 
>
>How can i realize that without having to define specific forwards 
>to the 5 pages and then deciding which one was the calling one?
>
>Tried the ActionMapping.getInputForward(), but it brought back 
>null values in the ActionForward only.
>
>Comments and keywords to look for welcome.


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


Re: Still struggeling: howto get ActionForward to calling page

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Elementary perhaps, but I have never had to do that in 5 years of web 
development. Could it be that your 'selection screens' might be overly 
complicated? Why do you need parameters?

asaupp@gmx.de wrote:
> yeap, that's something in a way i thought of as 'dirty fix' for a framework. As i am 
> looking into struts for 2-3 days only i am surprised to find such an elementary 
> functionallity not implemented? Should be interessting for plenty of people having more 
> than 2-3 pages nested in not linear way?
> 
> Alex
> 
> Send reply to:  	"Struts Users Mailing List" <st...@jakarta.apache.org>
> Date sent:      	Wed, 06 Aug 2003 10:50:00 +0200
> From:           	Adam Hardy <ah...@cyberspaceroad.com>
> To:             	Struts Users Mailing List <st...@jakarta.apache.org>
> Subject:        	Re: Still struggeling: howto get ActionForward to calling page
> 
> [ Double-click this line for list subscription options ] 
> 
> The input attribute on the action mapping is what you specify for the 
> return page when validation of the form bean fails, so that is not going 
> to help you.
> 
> The easiest solution I can think of is to put a hidden field in your 
> selection screens with the screen's URL in it.
> 
> Alternatively you could try using the HTTP header referer e.g.:
> 
> Referer: http://www.w3.org/hypertext/DataSources/Overview.html
> 
> but this is an optional header so not all browsers have to send it. I've 
> never used it so I don't know which browsers do send it.
> 
> hth
> Adam
> 
> asaupp@gmx.de wrote:
> 
>>Hi, 
>>
>>i am still looking for a clean way to get an ActionForward to the page that called my 
>>current Action. That means e.g. I am a displayListAction and have been called by a 
>>selection screen. In case i don't find a result for the selection parameters I would like to 
>>bring a specific error to the calling selection screen. That would give users a chance to 
>>change their selection. 
>>
>>Sounding easy, this gets complicate in case there are several selection screens 
>>bringing up the same list. I don't like to create a specific forward for each selection page 
>>and then somehow determine which one called me (can do that, but there should be a 
>>nice way in such a famous framework?). 
>>
>>The hint using 
>>	ActionMapping.getInputForward()
>>	or new ActionForward(mapping.getInput())
>>didn't help me to much, seems to me there is hardcoded value inside, specified in the 
>>input attribute of the specific action.
>>
>>How would an expert solve that problem?
>>
>> :-) Alex
>>
>>
>>
>>
>>
>>>Looking for a way to get an ActionForward to the page calling the 
>>>current page. 
>>>
>>>The example: 
>>>Want to realize 5-XX pages where to enter values for a 
>>>calculation. The calculation & result page would check if 
>>>everything was fine (using db queries etc..)
>>>Now in case that one of the input values is incorrect / 
>>>missmatching the context, I'd like to redisplay the calling page 
>>>showing the values entered before + an error message. 
>>>
>>>How can i realize that without having to define specific forwards 
>>>to the 5 pages and then deciding which one was the calling one?
>>>
>>>Tried the ActionMapping.getInputForward(), but it brought back 
>>>null values in the ActionForward only.
>>>
>>>Comments and keywords to look for welcome.
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


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


Re: Still struggeling: howto get ActionForward to calling page

Posted by as...@gmx.de.
yeap, that's something in a way i thought of as 'dirty fix' for a framework. As i am 
looking into struts for 2-3 days only i am surprised to find such an elementary 
functionallity not implemented? Should be interessting for plenty of people having more 
than 2-3 pages nested in not linear way?

Alex

Send reply to:  	"Struts Users Mailing List" <st...@jakarta.apache.org>
Date sent:      	Wed, 06 Aug 2003 10:50:00 +0200
From:           	Adam Hardy <ah...@cyberspaceroad.com>
To:             	Struts Users Mailing List <st...@jakarta.apache.org>
Subject:        	Re: Still struggeling: howto get ActionForward to calling page

[ Double-click this line for list subscription options ] 

The input attribute on the action mapping is what you specify for the 
return page when validation of the form bean fails, so that is not going 
to help you.

The easiest solution I can think of is to put a hidden field in your 
selection screens with the screen's URL in it.

Alternatively you could try using the HTTP header referer e.g.:

Referer: http://www.w3.org/hypertext/DataSources/Overview.html

but this is an optional header so not all browsers have to send it. I've 
never used it so I don't know which browsers do send it.

hth
Adam

asaupp@gmx.de wrote:
> Hi, 
> 
> i am still looking for a clean way to get an ActionForward to the page that called my 
> current Action. That means e.g. I am a displayListAction and have been called by a 
> selection screen. In case i don't find a result for the selection parameters I would like to 
> bring a specific error to the calling selection screen. That would give users a chance to 
> change their selection. 
> 
> Sounding easy, this gets complicate in case there are several selection screens 
> bringing up the same list. I don't like to create a specific forward for each selection page 
> and then somehow determine which one called me (can do that, but there should be a 
> nice way in such a famous framework?). 
> 
> The hint using 
> 	ActionMapping.getInputForward()
> 	or new ActionForward(mapping.getInput())
> didn't help me to much, seems to me there is hardcoded value inside, specified in the 
> input attribute of the specific action.
> 
> How would an expert solve that problem?
> 
>  :-) Alex
> 
> 
> 
> 
>>Looking for a way to get an ActionForward to the page calling the 
>>current page. 
>>
>>The example: 
>>Want to realize 5-XX pages where to enter values for a 
>>calculation. The calculation & result page would check if 
>>everything was fine (using db queries etc..)
>>Now in case that one of the input values is incorrect / 
>>missmatching the context, I'd like to redisplay the calling page 
>>showing the values entered before + an error message. 
>>
>>How can i realize that without having to define specific forwards 
>>to the 5 pages and then deciding which one was the calling one?
>>
>>Tried the ActionMapping.getInputForward(), but it brought back 
>>null values in the ActionForward only.
>>
>>Comments and keywords to look for welcome.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


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


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


Re: Still struggeling: howto get ActionForward to calling page

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
The input attribute on the action mapping is what you specify for the 
return page when validation of the form bean fails, so that is not going 
to help you.

The easiest solution I can think of is to put a hidden field in your 
selection screens with the screen's URL in it.

Alternatively you could try using the HTTP header referer e.g.:

Referer: http://www.w3.org/hypertext/DataSources/Overview.html

but this is an optional header so not all browsers have to send it. I've 
never used it so I don't know which browsers do send it.

hth
Adam

asaupp@gmx.de wrote:
> Hi, 
> 
> i am still looking for a clean way to get an ActionForward to the page that called my 
> current Action. That means e.g. I am a displayListAction and have been called by a 
> selection screen. In case i don't find a result for the selection parameters I would like to 
> bring a specific error to the calling selection screen. That would give users a chance to 
> change their selection. 
> 
> Sounding easy, this gets complicate in case there are several selection screens 
> bringing up the same list. I don't like to create a specific forward for each selection page 
> and then somehow determine which one called me (can do that, but there should be a 
> nice way in such a famous framework?). 
> 
> The hint using 
> 	ActionMapping.getInputForward()
> 	or new ActionForward(mapping.getInput())
> didn't help me to much, seems to me there is hardcoded value inside, specified in the 
> input attribute of the specific action.
> 
> How would an expert solve that problem?
> 
>  :-) Alex
> 
> 
> 
> 
>>Looking for a way to get an ActionForward to the page calling the 
>>current page. 
>>
>>The example: 
>>Want to realize 5-XX pages where to enter values for a 
>>calculation. The calculation & result page would check if 
>>everything was fine (using db queries etc..)
>>Now in case that one of the input values is incorrect / 
>>missmatching the context, I'd like to redisplay the calling page 
>>showing the values entered before + an error message. 
>>
>>How can i realize that without having to define specific forwards 
>>to the 5 pages and then deciding which one was the calling one?
>>
>>Tried the ActionMapping.getInputForward(), but it brought back 
>>null values in the ActionForward only.
>>
>>Comments and keywords to look for welcome.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


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