From: "Brian McSweeney" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Subject: RE: Design Question - same action, many jsps/views Date: Mon, 28 Jul 2003 16:26:52 +0100
Hi Hue,
That's definitely one way to go, but the disadvantage that I see of using this way is that you presumably have to hard code into the action, some way of identifying where the request came from. Perhaps
something like:
String input = request.getRequestURI();
if(input.equalsIgnorCase("inputpath1")
return (mapping.findForward("page1")); else if(input.equalsIgnorCase("inputpath2");
return (mapping.findForward("page2")); else if(input.equalsIgnorCase("inputpath3");
return (mapping.findForward("page3"));
The previous new action mapping idea means you don't have to do this I think, which might make it a better solution. What do you think?
I'm not sure though, and thanks very much for the help. Brian
-----Original Message----- From: Hue Holleran [mailto:[EMAIL PROTECTED] Sent: 28 July 2003 16:11 To: Struts Users Mailing List Subject: RE: Design Question - same action, many jsps/views
Hi Brian,
Why not use different named forwards for the action and access each one from the action with a:
{
...
return (mapping.findForward("page1/page2/page3"));
}In s-c:
<action path="/myAction" type="<FQ Class>" name="<bean>" ... > <forward name="page1" path="/page1.jsp"/> <forward name="page2" path="/page2.jsp"/> <forward name="page3" path="/page3.jsp"/> </action>
Hue.
> -----Original Message----- > From: Brian McSweeney [mailto:[EMAIL PROTECTED] > Sent: 28 July 2003 10:39 > To: [EMAIL PROTECTED] > Subject: Design Question - same action, many jsps/views > > > Hi all, > > I've come across a situation which I'm not sure how to handle with > struts. > I have an action which, depending on from which page it's called, > should forward to different jsps pages. > > Currently, for each resultant jsp, I create a new action with the exact > same > logic code inside which forwards to the right jsp. > > I'm just not sure if this is the right way to do it, because it's > replication of code. > An alternative might be to switch on the input path of the request and > forward to > The right jsp, but I'm not sure if this is right either. This has to > have come up > before, so I'm looking for a best practice solution. > > What do you guys reckon? > > Thanks, > Brian > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.504 / Virus Database: 302 - Release Date: 24/07/2003 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 24/07/2003
--------------------------------------------------------------------- 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]
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

