You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Benjamin Lerman <Be...@ambre.net> on 2005/11/20 22:57:57 UTC

Dynamically altering struts configuration

 Hi all,

 Let say I have a line like this one in my struts-config.xml:

<form-bean name="fooForm" type="net.ambre.epingles.struts.form.fooForm" />

 Can I change dynamically the type associated to fooForm ?

 Thanks

	Benjamin

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


Re: Dynamically altering struts configuration

Posted by Benjamin Lerman <Be...@ambre.net>.
> can you please demonstrate how u did that? where do we use the ModuleConfig
> Object...

 Well, you have two solutions to get an ModuleConfig object.

 You can get it in a struct actions, using
getServletContext().getAttribute(Globals.MODULE_KEY), or in any place
that can get the ServletContext, or (the way I choose), you can inherit
from ActionServlet, and overload initModuleConfig.

	Benjamin

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


Re: Dynamically altering struts configuration

Posted by Simpy Ahuja <si...@gmail.com>.
can you please demonstrate how u did that? where do we use the ModuleConfig
Object...

On 11/22/05, Benjamin Lerman <Be...@ambre.net> wrote:
>
> > I don't actually know.
>
> I found out. With a ModuleConfig object you can retrieve the ActionForm
> mappings and modify it.
>
> > But why would you want to?
>
> I want to be able to define an external module that plugs in an
> existing struts application. This module must define a .jsp file and a
> form to get some data without the existing struts application knowing
> what are those datas (so to be able to change the module without
> changing the application). That's the reason I need to be able to change
> the actionForm mapping dynamically.
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


--
Sincerely,
Simpy Ahuja
+919350185502

Re: Dynamically altering struts configuration

Posted by Benjamin Lerman <Be...@ambre.net>.
> I don't actually know.

 I found out. With a ModuleConfig object you can retrieve the ActionForm
mappings and modify it.

> But why would you want to?

 I want to be able to define an external module that plugs in an
existing struts application. This module must define a .jsp file and a
form to get some data without the existing struts application knowing
what are those datas (so to be able to change the module without
changing the application). That's the reason I need to be able to change
the actionForm mapping dynamically.

	Benjamin

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


Re: Dynamically altering struts configuration

Posted by Dave Newton <ne...@pingsite.com>.
Benjamin Lerman wrote:

> Let say I have a line like this one in my struts-config.xml:
><form-bean name="fooForm" type="net.ambre.epingles.struts.form.fooForm" />
> Can I change dynamically the type associated to fooForm ?
>  
>
I don't actually know.

But why would you want to? Perhaps looking at a custom request processor 
and implementing processActionForm might be a possible solution?

Dave



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