OK Ted, Result selector is real way to do. It would not introduce any new configuration ( xwork config parser can be used ) and it can be made flexible and extendable as <i do not know what> ;)
And AFAIR standart results/distpatchers already use OGNL on supplied destinations, so this kind of functionality could be achieved even without creating additional result types. --- Ted Husted <[EMAIL PROTECTED]> wrote: > Yes, but they map to a single path. A business > result, like "success", > "failure", and "exception", might map to a cluster > of paths, depending > on concerns like security role, locale, browser > type, ajax mode, and > so forth. As said before, OGNL is possible, and if action takes care about role (thouh there are better ways to do this), it could as well take care ot result name selection. > We can use "presentation logic" in the server page > or template, but if > there are multiple concerns, the template becomes > messy, and it starts > to look like a hack. If you start mixing concerns, you end up with an ugly hack. Either in your action, or in tempklate - it's just a matter of personal preference where you like to have your mess ;) > If we are willing to resolve all these concerns in > the Action, the > problem goes away. But, I think we agree that some > of these concerns > are outside the scope of the Action. > > > > > But, what if there are flavors of success or > > > failure?. > > > > ... they are kind of different results. > > Yes, and the difference is based on concerns that > might be outside the > scope of a business-orientated Action, so the Action > has no clean way > to select the correct result. > > > > >As Don points > > > out, we might want to present different pages > based > > > on the browser. > > > > What action got to do with it? > > The Action class itself should have nothing to do > with it. But, the > action element, which, in effect, encapsulates the > paths, should be > able to select from a cluster of paths, based on > concerns outside the > scope of the Action class. > > > > > > > Or, we might want to present different pages > based > > > on locale? > > ... not an action business. result shall take care > of > > this ( like rewrite rules in httpd - call it > > LocalAwareResult which pulls locale and , say, > adds > > proper suffix ) > > > Or based on security role? > > ... again result could take this over. or even > > template itself.> > > > Do we want to cram all this into a single result > > > code? > > > > yep. with proper results and maybe kind of > > interceptors > > OK, the Result takes it over. But where do we > encapsulate the paths, > if not in the action element? > > > > > return findResult("success"); > > > > > > Congratulation. You are describing ( somehow ) > > situation of struts-1 - action has to be aware of > > servlet environment and take decisions based on > it. > > And how are you going to sumulate this in tests? > > Yes, this is a straw argument to illustrate the need > to keep this code > in the scope of a Result. But, if we do this in the > scope of a Result, > then we need a way to encapsulate the paths utilized > by the Result. Maybe it is rhetorically imperfect, but this situation lead me away from using Struts 1 and switch to webwork > > > But, in practice, this has proven to be a very > > > common use case. > > > There's the browser-agent case, the ajax-case, > the > > > localization-case, > > > the security-roles case, to name a few. We often > > > want to select a > > > specialized result for the same general outcome > > > ("success", "failure", > > > "error", "exception", "login") . > > > > Why do it in action? > > Exactly. Better to do it in a type of Result that > can be configured to > accept a cluster of paths, like an Action, but > focused on a different > concern or set of concerns. +1. regards, ----[ Konstantin Pribluda http://www.pribluda.de ]---------------- Still using XDoclet 1.x? XDoclet 2 is released and of production quality. check it out: http://xdoclet.codehaus.org ____________________________________________________________________________________ Get your email and see which of your friends are online - Right on the New Yahoo.com (http://www.yahoo.com/preview) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]