> -----Original Message----- > From: Jerome Jacobsen [mailto:[EMAIL PROTECTED] > Sent: 24 February 2003 16:24 > To: Struts Users Mailing List > Subject: RE: [TILES] Foxy Tiles Problem > > > Not sure if this will help, but here goes. I have Form based > JSPs that can > be used across multiple actions. Therefore these JSPs have > dynamic form > action attributes. I didn't want to set the form action in the Action > class. Instead I define it in struts-config.xml on a per > action mapping > basis. > > To accomplish this I could've used the parameter attribute of > the action > mapping and then in my JSP do something like this: > > <bean:define id="mapping" name="<%= > org.apache.struts.Globals.MAPPING_KEY > %>"/> > <html:form action="<%= mapping.getParameter() %>" ...> > > And in struts-config.xml have something like this: > > <action path="/actionA" type="com.blah.FirstAction" name="myForm" > parameter="/actionX"> > <forward name="success" path="/myReusableFormPage.jsp"/> > </action> > > <action path="/actionB" type="com.blah.SecondAction" name="myForm" > parameter="/actionY"> > <forward name="success" path="/myReusableFormPage.jsp"/> > </action> > > However I also wanted the ability to apply other properties to action > mappings so the JSP could be generic. Therefore instead of using the > parameter attribute I defined my own ActionMapping subclass > and make use of > the set-property element of the action mapping. My subclass > has a single > Map property called "property". > > public class PropertiesActionMapping extends ActionMapping { > private Map property = new Hashtable(); > > public PropertiesActionMapping() { > } > > public Map getProperty() { > return property; > } > > public void setProperty(Map value) { > property = value; > } > } > > Now in struts-config.xml I can do this: > > <action path="/actionA" type="com.blah.FirstAction" name="myForm" > className="com.blah.PropertiesActionMapping"> > <set-property property="property(titleKey)" value="actionX.title"/> > <set-property property="property(formAction)" value="/actionX"/> > <forward name="success" path="/myReusableFormPage.jsp"/> > </action> > > <action path="/actionB" type="com.blah.SecondAction" name="myForm" > className="com.blah.PropertiesActionMapping"> > <set-property property="property(titleKey)" value="actionY.title"/> > <set-property property="property(formAction)" value="/actionY"/> > <forward name="success" path="/myReusableFormPage.jsp"/> > </action> > > And now the JSP looks like this: > > <bean:define id="mapping" name="<%= > org.apache.struts.Globals.MAPPING_KEY > %>"/> > > <title><bean:message name="mapping" > property="property(titleKey)"/></title> > ... > <html:form action='<%= mapping.getProperty("formAction") %>' ...> > > The code I've shown above isn't actually how I do it since > I'm using the > JSTL-EL. > > HTH > Jerome
I think your solution is a pretty neat solution to a global successive action mapper. It would work well for a dynamic wizard application, where you do not know at static compile time what the list of actions are. In this way you can generate dynamically a previous action and a successive mapping. However for my purposes I cannot use it for tab bar navigation. The simplest solution I found was to use <tiles:useAttribute /> to declare and define a tiles context parameter --////-- -- Peter Pilgrim, Struts/J2EE Consultant, RBoS FM, Risk IT Tel: +44 (0)207-375-4923 ******************************************************************** Visit our Internet site at http://www.rbsmarkets.com This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. The Royal Bank of Scotland plc is registered in Scotland No 90312 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Regulated by the Financial Services Authority ******************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]