You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ratnadeep Bhattacharjee <Ra...@east.sun.com> on 2001/02/14 17:52:26 UTC

controlling the next page to be displayed

Hi,

I am quite new to Struts and was wondering if someone could help me with the 
following issue:

I am on a web page and I have entered some data and I click on Submit. Now, the 
Action class correspoding to its JSP page gets executed. I would like the 
perform() method of the Action class to determine the next page that should be 
displayed (based on data I had entered). 

If I use 
		return (mapping.findForward("success"))
		
I can go to one page only - the one that is mentioned in my struts-config.xml. 

	<forward name="success" path="/mypath/mybasic.jsp">
	
I would like to go to one of many pages on success.


Thanks,
-Deep.




Re: controlling the next page to be displayed

Posted by Craig Tataryn <Cr...@msdw.com>.
Craig M. answered this question yesterday in a mail titled: "Proper way to
'forward' dynamically"

<Craig M. said>
When I need this, I just create a new ActionForward dynamically:

    String path = ... create context-relative path to new page ...
    return (new ActionForward(path));

The path you calculate must be context relative and start with a slash, exactly
like the "path" attributes to your standard <forward> elements.
</Craig M. said>

Ratnadeep Bhattacharjee wrote:

> Hi,
>
> I am quite new to Struts and was wondering if someone could help me with the
> following issue:
>
> I am on a web page and I have entered some data and I click on Submit. Now, the
> Action class correspoding to its JSP page gets executed. I would like the
> perform() method of the Action class to determine the next page that should be
> displayed (based on data I had entered).
>
> If I use
>                 return (mapping.findForward("success"))
>
> I can go to one page only - the one that is mentioned in my struts-config.xml.
>
>         <forward name="success" path="/mypath/mybasic.jsp">
>
> I would like to go to one of many pages on success.
>
> Thanks,
> -Deep.

--
I've been trying to change the world for years, but they just won't give me the
source code....