> -----Original Message----- > From: Ted Husted [mailto:[EMAIL PROTECTED]] > IMHO, the best way to use XML is as a generator/decorator for > objects. One decoration might be to pass a script to a Java class > for processing, but framing conditions in a XML files seems to > step over the line to me.
Fair enough. My real goal is to separate > Right now, a very good way to test preconditions is through a > component like the Struts validator. It plugs into the ActionForm > and confirms that whatever properties are needed are ready, > willing and agle to go. I'll take a look (we're in 1.0.2 land at the moment, and I wasn't aware that the validator worked with it). > In the normal course, an Action should not need to interact with > the request or session at all. The ActionForm should encapsulate > whatever input is needed. How does the ActionForm work with Cookies? Ancient, legacy systems that maintain their own notion of session state? I thought ActionForms only work with request parameters, request attributes and session attributes. > The routing instructions in Struts are the ActionForwards. The > Actions can select a destiation using a logical name, and that > name is mapped to a destination in the configuration. Yeah, but that's only part of the equation. To me, how actions choose *which **logical** name to use* is routing logic as well, right? Surely the simple hashtable lookup that happens with a mapping.findForward() does not itself wholly constitute all of Struts routing logic! Here's a situation we run into all the time: 1. URL /a/b/c comes in. 2. Struts routes that to RedirectorAction using its normal features, i.e. struts-config.xml, ActionMappings, ActionForms, etc. 3. ROUTING LOGIC: RedirectorAction makes connection to Big Hairy Nasty Old Legacy System to get Magic Flag. If Magic Flag is "QRC&@43", then return mapping.findForward("condition1"); if Magic Flag is "7#5%FFX" AND Obscure Cookie Foobar is set to "87YYX", then return mapping.findForward("condition2"); else return mapping.findForward("defaultCondition") (Note that the ActionForward returned for mapping.findForward("condition1"), etc. is not a JSP page or another view component, but another controller component (usually another Action in the same webapp)). We have Actions all over the place that do some variation on (3). Note that this hypothetical RedirectorAction never invokes business objects--it's just a rules engine that augments Struts' existing routing logic, since "/a/b/c" is not enough on its own--even with its associated ActionForm--to uniquely select the proper destination. So all I'd like to do is move this kind of rules engine stuff up into Struts' *existing* rules engine stuff--the ActionMapping class, or at least its XML representation--so that all the rules engine processing (Struts' native "if path ends with '/a/b/c then invoke ActionX" and ActionX's "if Magic Flag is 'QRC&@43', then return mapping.findForward('conditional')") is in the same "place". Whether that's in an XML file, a separate configuration file, a BSF script, etc. doesn't matter to me. Cheers, Laird -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>