It is done automagically upon startup of your application. When struts processes it's config (struts-config.xml) it generates ActionMapping instances for each <action>. When you specify your extended ActionMapping in the className attribute of <action> struts will populate the related property or properties of that class. Your extended Action mapping must have matching getter/setter properties that match you property="" value (i.e. <set-property property="aProperty" value="aValue"/> relates to public setAProperty(String aValue){};)
One of the issues you might run into is that you cant easily change the properties during runtime. If you make role changes to the Action you will have to reboot the webapp. This is usually not a major deal. Brandon Goodin Phase Web and Multimedia PO Box 85 Whitefish MT 59937 P (406) 862-2245 F (406) 862-0354 [EMAIL PROTECTED] http://www.phase.ws -----Original Message----- From: Sloan Seaman [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 12:56 PM To: Struts Users Mailing List Subject: Re: Passing parameters to Actions Ok. sounds like a plan. Question though: How do I access the <set-property> information? Do I have to parse the XML or something? Sorry... I'm a bit new to Struts... -- Sloan ----- Original Message ----- From: "Brandon Goodin" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, February 25, 2003 2:40 PM Subject: RE: Passing parameters to Actions > Here is a config sample: > > <action path="/myAction.do" > parameter="submit" > type="com.foo.MyAction" > name="myForm" > scope="request" > className="com.foo.MyExtendedActionMapping"> > <set-property property="xxx" value="yyy"/> > <forward name="success" path="here.jsp" redirect="false"/> > <forward name="fail" path="there.jsp" redirect="true"/> > </action> > > Brandon Goodin > Phase Web and Multimedia > PO Box 85 > Whitefish MT 59937 > P (406) 862-2245 > F (406) 862-0354 > [EMAIL PROTECTED] > http://www.phase.ws > > > -----Original Message----- > From: Brandon Goodin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 25, 2003 12:33 PM > To: Struts Users Mailing List > Subject: RE: Passing parameters to Actions > > > parameter is only used for dispatch actions. If you want to set properties > for an action... you can extend the ActionMapping class and use the > set-property in an action element while specifying the className attribute > of the action element. > > Brandon Goodin > Phase Web and Multimedia > PO Box 85 > Whitefish MT 59937 > P (406) 862-2245 > F (406) 862-0354 > [EMAIL PROTECTED] > http://www.phase.ws > > > -----Original Message----- > From: Sloan Seaman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 25, 2003 12:29 PM > To: Struts Users Mailing List > Subject: Passing parameters to Actions > > > In the struts-config.xml file I want to pass a few parameters to my actions > but it looks like the DTD only supports one "parameter" tag. > > I.E.: > <action path="/app/main" > type="com.symbol.mobilecommerce.analysis.actions.app.Main" > name="app.main" > parameter="admin" > > > <forward name="PAGE_SRC" path="/app/main.jsp"/> > <forward name="PAGE_ACCESS_DENIED" path="/index.jsp"/> > </action> > > When I would rather do something like: > <action path="/app/main" > type="com.symbol.mobilecommerce.analysis.actions.app.Main" > name="app.main" > > > <forward name="PAGE_SRC" path="/app/main.jsp"/> > <forward name="PAGE_ACCESS_DENIED" path="/index.jsp"/> > <parameter name="ROLES_ALLOWED" value="admin"/> > </action> > > Now, I know there is a roles attribute but we are doing out own security > model and are not using request.isUserInRole(). > > (BTW: is there any way to write to whatever request.isUserInRole() used to > do its lookup so we can use it?) > > Is there any way to have parameters passed like how I would like? > > I could spoof <forward> to something like <forward name="ROLES_ALLOWED" > path="admin"/> but I would rather not. > > Thanks! > > -- > Sloan > > > > --------------------------------------------------------------------- > 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] > > --------------------------------------------------------------------- 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]