You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zsolt Koppany <zk...@web.de> on 2003/03/01 08:37:28 UTC
RE: one more prepopulate question
Where do I have to insert this code?
Zsolt
> Actually, unless you are going (back) to a page that contains a form with action of "setupMultipleForms" you can't use this strategy.
>
> What you actually need to know is the name attribute of the action mapping corresponding to the page to which the user is being directed *next*. However, this isn't the end of the world; you can programmatically figure the name of the form-bean etc as follows:
>
> ApplicationConfig appConfig = (ApplicationConfig)
> request.getAttribute(Globals.APPLICATION_KEY);
> ActionConfig actionConfig = appConfig.findActionConfig("/foo");
> String name = actionConfig.getName(); // Form bean name
> String attribute = actionConfig.getAttribute(); // Attribute to store under
> String scope = actionConfig.getScope(); // Scope to store in
> FormBeanConfig fbConfig = appConfig.findFormBeanConfig(name);
>
> Now you've got all the metadata you need to dynamically instantiate the
> appropriate form bean, and store it under the appropriate attribute in the
> appropriate scope, without hard coding any of this stuff.
>
> This is a snippet that Craig wrote up in response to an earlier post.
>
>
> Sri
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
Zsolt
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org