You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Diego Manilla Suárez <di...@xeridia.com> on 2005/02/21 12:39:36 UTC
Add action mappings on the fly
Hi! I'm trying to add an ActionMapping definition dinamically (using
ModuleConfig.addActionConfig method), but I get an IllegalStateException
(configuration is frozen). Is there a way to do what I want?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Form bean and variable number of fields
Posted by Tom Ziemer <t....@dkfz-heidelberg.de>.
Hi,
I've had the same problem and used a mapped backed form bean, which
worked really well. Now I am wondering whether it's possible to use the
validator plugin to validate the entries. The only problem is that
a) I don't know what kind of properties and
b) how many of them are submitted.
Any ideas?
Regards,
Tom
Muhammad Asif wrote:
> Thanks for your reply Jeff. I am trying to develop a simple action and bean with mapped properties for proof of concept. This will confirm if i can use these.
>
> Asif
>
> At 06:02 PM 2/22/2005, you wrote:
>
>>Have you looked at indexed and/or mapped form bean properties?
>>
>>Muhammad Asif wrote:
>>
>>>Hi,
>>>I have a form that contains variable number of fields. User can add/remove fields on this form dynamically (using some separate gui). For using a form-bean we need to know number of fields before hand if new fields are added we need to change form-bean definition each time. Is there way to automate this process or any alternate.
>>>Thanks.
>>>Asif
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Form bean and variable number of fields
Posted by Muhammad Asif <md...@wol.net.pk>.
Thanks for your reply Jeff. I am trying to develop a simple action and bean with mapped properties for proof of concept. This will confirm if i can use these.
Asif
At 06:02 PM 2/22/2005, you wrote:
>Have you looked at indexed and/or mapped form bean properties?
>
>Muhammad Asif wrote:
>>Hi,
>>I have a form that contains variable number of fields. User can add/remove fields on this form dynamically (using some separate gui). For using a form-bean we need to know number of fields before hand if new fields are added we need to change form-bean definition each time. Is there way to automate this process or any alternate.
>>Thanks.
>>Asif
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Form bean and variable number of fields
Posted by Jeff Beal <jb...@webmedx.com>.
Have you looked at indexed and/or mapped form bean properties?
Muhammad Asif wrote:
> Hi,
>
> I have a form that contains variable number of fields. User can add/remove fields on this form dynamically (using some separate gui). For using a form-bean we need to know number of fields before hand if new fields are added we need to change form-bean definition each time. Is there way to automate this process or any alternate.
>
> Thanks.
>
> Asif
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Form bean and variable number of fields
Posted by Muhammad Asif <md...@wol.net.pk>.
Hi,
I have a form that contains variable number of fields. User can add/remove fields on this form dynamically (using some separate gui). For using a form-bean we need to know number of fields before hand if new fields are added we need to change form-bean definition each time. Is there way to automate this process or any alternate.
Thanks.
Asif
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Add action mappings on the fly
Posted by Diego Manilla Suárez <di...@xeridia.com>.
Thanks everyone for your replies. I didn't know the wildcard matching
feature in action mappings. With this feature and map-backed ActionForms
now I can do more or less what I wanted to do.
Regards,
Diego.
Joe Germuska wrote:
> At 12:39 PM +0100 2/21/05, Diego Manilla Suárez wrote:
>
>> Hi! I'm trying to add an ActionMapping definition dinamically (using
>> ModuleConfig.addActionConfig method), but I get an
>> IllegalStateException (configuration is frozen). Is there a way to do
>> what I want?
>
>
> Well, you haven't really explained what you want! As Struts is
> implemented, no, you can't add action configs; on the other hand,
> ModuleConfig is an interface, so you could provide a different
> implementation of ModuleConfig which either didn't use freezing
> (probably a bad idea, unless you come up with an alternative way to
> deal with synchronization issues in a multi-threaded execution
> environment) or which created a new ActionConfig object as needed.
> This is essentially what Struts already does in supporting wild-card
> matched action paths. It locates the ActionConfig whose path pattern
> matches the current request path and clones it, optionally replacing
> certain values based on the match.
>
> Joe
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Add action mappings on the fly
Posted by Don Brown <do...@gmail.com>.
Or use an action mapping that matches "/*". I use them with
MappingDispatchAction to match "/*/*" where the first is the action
class and the second is the function to call.
Don
On Mon, 21 Feb 2005 22:40:17 -0500, David G. Friedman
<hu...@ix.netcom.com> wrote:
> Diego,
>
> Here is an idea: You could always set your on-the-fly actions under a
> module. Then you could use the unknown="true" attribute to route all
> unmatched /module/*.do mappings to your new Action, which handles the lookup
> and dynamic dispatching to the appropriate pages/actions, probably via a map
> lookup or other type of table lookup to find your new dynamic mappings.
>
> Regards,
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Add action mappings on the fly
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Diego,
Here is an idea: You could always set your on-the-fly actions under a
module. Then you could use the unknown="true" attribute to route all
unmatched /module/*.do mappings to your new Action, which handles the lookup
and dynamic dispatching to the appropriate pages/actions, probably via a map
lookup or other type of table lookup to find your new dynamic mappings.
Regards,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Add action mappings on the fly
Posted by Joe Germuska <Jo...@Germuska.com>.
At 12:39 PM +0100 2/21/05, Diego Manilla Suárez wrote:
>Hi! I'm trying to add an ActionMapping
>definition dinamically (using
>ModuleConfig.addActionConfig method), but I get
>an IllegalStateException (configuration is
>frozen). Is there a way to do what I want?
Well, you haven't really explained what you want!
As Struts is implemented, no, you can't add
action configs; on the other hand, ModuleConfig
is an interface, so you could provide a different
implementation of ModuleConfig which either
didn't use freezing (probably a bad idea, unless
you come up with an alternative way to deal with
synchronization issues in a multi-threaded
execution environment) or which created a new
ActionConfig object as needed. This is
essentially what Struts already does in
supporting wild-card matched action paths. It
locates the ActionConfig whose path pattern
matches the current request path and clones it,
optionally replacing certain values based on the
match.
Joe
--
Joe Germuska
Joe@Germuska.com
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Add action mappings on the fly
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
It can be done, but I suspect everyone on the list will tell you not to
do it, and for very good reasons.
However, I'm one of those "here's your rope sir, try not to hang
yourself with it" kind of guys, so here's how...
The ModuleConfigImpl has a member "configured". This is what determines
if the configuration is "frozen" or not. You will need to set it to
false. However, there is no unfreeze() method because you are not meant
to be able to unfreeze it.
To do so anyway, create a class something like this:
package org.apache.struts.config.impl;
public class MCUtils {
public static void unfreeze(ModuleConfig mc) {
mc.configured = false;
}
}
Call unfreeze, passing an instance of your ModuleConfig object, and
you'll be able to do all the Very Bad Things(tm) you want with it. You
may open the gates of Hell by doing this, but it's your apocalypse.
As I indicated though... I wouldn't be surprised if you get 25 other
replies, most of which say "don't do it!!" and many of which say "you
can't do it". The former are correct, the later are not. :)
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
Diego Manilla Suárez wrote:
> Hi! I'm trying to add an ActionMapping definition dinamically (using
> ModuleConfig.addActionConfig method), but I get an IllegalStateException
> (configuration is frozen). Is there a way to do what I want?
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org