Ahmet ISIK wrote:

I'm doing it in a plugin.
My purpose is to develop generic CRUD operations, views and forms for any model object that is persisted using Hibernate. For this, I introspect Hibernate config and provide form fields according to underlying object's properties.
I'm declaring actionmappings at runtime because I'm asking Hibernate for a list of entities that are declared.



Modifying the configuration information in a PlugIn is specifically allowed, for precisely this kind of purpose. It is safe, because plugins are called from the init() method of ActionServlet, and must all complete successfully before the first request is processed.


Struts freezes the configuration information *after* the plugins have been initialized; from that point on, you'll get IllegalStateExceptions if you try to modify existing XxxConfig beans in any way.

Craig


Martin Cooper wrote:

"Ahmet ISIK" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

thanks Martin,
I have found a solution. I have acquired module config by
Globals.MODULE_KEY key from app context. Then I added programmatically
configured ActionMappings to module config object. after that it is
possible to use those action mappings. Is this a bad practice?



Where are you doing this? (And why?)


If you're doing it in a plug-in, then I believe it will work, but I don't
see how that would be any more "dynamic" than adding them to your Struts
config file. (Also in that case, you are already passed the module config,
so you wouldn't need to look it up, as you mentioned you are doing.)


If you're doing it outside of a plug-in, then I'm puzzled. Once Struts loads
the config, it freezes it and throws IllegalStateException if you attempt to
modify it.


--
Martin Cooper



Martin Cooper wrote:

"Ahmet ISIK" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


Hi,
Is it possible to declare struts action mappings at runtime, and how?



No, it's not possible. The config is read in at application startup and


is


then frozen. (The reason it's done this way is so that access to the


config


does not need to be synchronised once the app is up and running, thus
leading to much improved overall performance.)

--
Martin Cooper




Thanks in advance

--
Ahmet ISIK
Ideal Teknoloji Bilisim Çözümleri A.S.- Iliskisel Is Kanali
Yazilim Muhendisi
http://www.idealteknoloji.com






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Ahmet ISIK
Ideal Teknoloji Bilisim Çözümleri A.S.- Iliskisel Is Kanali
Yazilim Muhendisi
[EMAIL PROTECTED]
http://www.idealteknoloji.com






---------------------------------------------------------------------
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]



Reply via email to