> -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] Behalf Of Muhammad > Momin Rashid > Sent: Thursday, July 22, 2004 9:30 AM > To: [EMAIL PROTECTED] > Subject: Re: Form Bean and decions based on Business Logic calls > > > Thank you for your quick response. > > I do have the appropriate action class with the desired > forwards defined (as > you have also outlined), but the problem is that the form > bean itself is > making the business logic calls to get its desired data. > Upon failure to > get the desired data, how can I forward to a different page?
Easiest way is to throw the exceptions outside the bean, and define what pages those exceptions go to in the struts-config.xml file. > Keeping in > mind that the decision to forward to an failure action is to > be done within > the Form Bean here. > > I am also interested in knowing if this is the correct > approach to have the > form bean make such calls. If not, then kindly suggest a better > implementation. Probably not. Much better to have the action setup the form bean and use the form bean strictly for display purposes. Better yet the form bean is nothing but Strings for it's properties so your form will work as expected by the user (see other discussions and/or husted site for more detials). > > Regards, > Muhammad Momin Rashid. > > "Robert Taylor" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Define success and failure forwards in your struts-config > file for the > > specified action. > > > > In the action class (which should delegate to a business object), > > retrieve the data. Upon failure, forward to the "failure" forward, > > else forward to the "success" forward. > > > > You could achieve the same using declarative exceptions. > > > > If the list of countries doesn't vary between users, you > > can do this when your application starts up and place the > > country list in ServletContext. In this fashion, you only > > have a single database hit for getting the countries. > > > > robert > > > > > -----Original Message----- > > > From: news [mailto:[EMAIL PROTECTED] Behalf Of > Muhammad Momin Rashid > > > Sent: Thursday, July 22, 2004 10:38 AM > > > To: [EMAIL PROTECTED] > > > Subject: Form Bean and decions based on Business Logic calls > > > > > > > > > Hello, > > > > > > I have a form bean which needs to retrieve some > information from the > > > business logic. I want to know how I can redirect to > different pages on > the > > > bases of data retrieved. > > > > > > e.g. I need to retrieve and display a list of countries > for the user to > > > select from. In case of failure to retrieve the > information I would > like to > > > take user to a different page to indicate error. > > > > > > What would be the best way to accomplish this? I am > using struts 1.1 > with > > > Tiles. > > > > > > Regards, > > > Muhammad Momin Rashid > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]