From: Jason S. <jsw...@ya...> - 2003-01-08 14:02:54
|
--- Ross Keatinge <ro...@po...> wrote: > I think there is a need for both. Isn't that what the 'forward' or > 'redirect' choice in the mapping does in Struts? Certainly if your > initial request is a GET then I don't see why it should always come > back with a redirect. Maybe that is what you mean, only force it to > happen with a POST. I would agree with that. I think this could be accomplished by using setting the _REDIRECT setting for each _ACTION_FORWARD array to true or false. The ActionController would then either: if (_REDIRECT) { header('Location: '._PATH); } else { $_GET[_VIEW] = [view portion of _PATH] } the application.php would look like: if (!array_key_exists(_CONTROLLER, $_SESSION)) { $controller = new ActionController($options); $_SESSION[_CONTROLLER] = $controller; } $controller = &$_SESSION[_CONTROLLER]; if (array_key_exists(_ACTION, $_REQUEST)) { //release control to controller for further processing $controller->process($mappings, $_REQUEST); } $controller->showView(); That way, if there is an action specified, process it. If it redirects, you are done, else you always try to display a view (either action did not redirect, or there was no action specified to begin with). Regards, Jason __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |