You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2015/10/15 20:58:33 UTC

[s1] Setting configuration for an Action

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

I'd like to use struts-config.xml to set some properties on an action,
just like you might use <init-param> on a servlet.

I see that <set-property> is an option under <action> in the DTD and I
mistakenly thought that <set-property> would set properties on the
Action instance, but it actually sets properties on the ActionMapping
instance that Struts uses when parsing the configuration file. [1]

I just want a single property to be set on a single action (or anytime
that action is instantiated, I suppose). Is there a way to do that
without creating a custom ActionMapping (which, while easy, seems
architecturally distasteful for my use case)?

Thanks,
- -chris

[1]
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg21396.html
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWH/dZAAoJEBzwKT+lPKRYbnUP/Ax696nNxnFs75HrED/7Jelh
vmjFiUQUMkZufoWF4yMlU7KMLJ4VKSghIuOhsAElEEKbCtB435ZAt3f3D/AASE/p
UBk3Zz9UofCLHrXDWhBxAt4HKv1lnXCr0Qgs28oTgWIk+RSEiGxCJer6buABVUYE
3b8V3ib1NzPUE/9PwFsOG6jntPbT9v8BCyAPgz+7KI8x+//XJa9Ix+QshhmrPl5a
++CP27Vp8XgMRPAcKZkHT7MIUcAtxjyPq3D33wNl+ZTQtsRRNF38gyI5WwDKX9zv
LUBgPspXQtG7F1ibxvsHNS21967zb7ENJrXbjBx639ahCisMLUYsdvhj5OaeHIuu
VaD0mWbIzh/bToQ59hD5IvEz2ADifmGV/ReSi/WHcDB4n/Yjw3hYpOU2xOFz2jnP
EgkjYWSNjBF0E6IjgdRQXDDfy+CCgiLIOOOZLFGZ6mOZDgxQmitKiUu8FVyxOEZ2
4nxvMxrionJyJupR4WCjWsw++UeiscZonRNDaVcGj/+uNN3fkJF7nG1TwCOrN5sl
Om0AtXQIJjqAdGC7hvK0CwmQEBfCYL7ZrjEtCYYWjIq3OrpVR035Ov5W3UkPgb+d
Kb6yT3cHeKvduYh71+8wSozQ0WV0XNzPTKs2lZB+/SR5s4zWjhqow38cbOy/6QuB
q5bK2JXhCvIMyyZkPJF/
=oL5J
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [s1] Setting configuration for an Action

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

On 10/15/15 2:58 PM, Christopher Schultz wrote:
> I'd like to use struts-config.xml to set some properties on an
> action, just like you might use <init-param> on a servlet.
> 
> I see that <set-property> is an option under <action> in the DTD
> and I mistakenly thought that <set-property> would set properties
> on the Action instance, but it actually sets properties on the
> ActionMapping instance that Struts uses when parsing the
> configuration file. [1]
> 
> I just want a single property to be set on a single action (or
> anytime that action is instantiated, I suppose). Is there a way to
> do that without creating a custom ActionMapping (which, while easy,
> seems architecturally distasteful for my use case)?

After posting the above, I realized that I could override the default
ActionMapping object for a single action, which is less chaotic than I
had originally thought (I thought the ActionMapping class had to be
global). So this is working quite well, now.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWJmDwAAoJEBzwKT+lPKRYJuAP/2JU7ybzd9vJ+u8qryE3/+ts
F08RoD7pu3Fh8BEG7dVan4tcPFdcFrAOWC+afFhoeD15g3coW+7uXzID03rCbaEW
jhKwn/20AsIqQn6vYyiv1qof6s9WkpWu04FeYbGlvuu+miJEu4NG9/Kqz/V/hAZY
4V20PykFN01mKLT8I9SS9DubS0NL47YK81ZS16Y0bfyBKG1ZZgLXoH4bPhhhV3MC
s/y7JqD6FKF0MI0yqBFIaaMRmtAZ72zxAPogFHw32KEFn8+Bw9hLsu3XEm/ZjeqO
OB03P7e6tBSH86WOt75b2mmver2+I7hQPK/GNsbbOJp9Uzd/xd0FH+F9+01R0UH0
jHA/j7MtzOCTMxoAzc7/VsVFxkilciz2tfOnyhy5VuHZcKcfMspU8O2aWnh+0N/z
G70T6pkWyUFSrDdDdpOCbc9+rvboi5i13Hgd7mEe0cPp6av8xv/BMIaEtH1RH16R
dMIHn6yGbwyZHJyBbMi6Cw/4Ou2Zwwr82QO96SIvXqX37XNlTvhSQ0/P7p0ktrO3
rh+5tBR6Xvls0PTGq7b3aVSn37ox/JMUWJiG49cTGyGQvrZ8q8uEVsivXRAqO/Pm
XgwVfd+7BaOrx7DD8O1bCS7dAyvVj+sXwPrQsnNC/7oMap+YhNOh8buwqh8K6zhm
c/aY7N3YQctQNjQSd3Nz
=WUhf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org