You could create a dynamic Forward, and append a query string. Just be
sure to create a new ActionForward for this.

Or, you can create the ActionForm for the okDialog yourself. Here's a
method you could put in a base Action, and use it to create ActionForm
beans for other ActionMappings. 

/**
 * Return an instance of the ActionForm associated with the specified
 * path, if any; otherwise return <code>null</code>.
 * May be used to create an ActionForm for InvokeAction.
 *
 * @param name path of the Action using the ActionForm bean
 */
public ActionForm createActionForm(String path) {

    ActionMapping mapping = findMapping(path);
    String name = mapping.getName();

    ActionForm form = null;

    ActionFormBean formBean = findFormBean(name);
    if (formBean != null) {
        String className = null;
        className = formBean.getType();
        try {
            Class clazz = Class.forName(className);
            form = (ActionForm) clazz.newInstance();
        } catch (Throwable t) {
            form = null;
        }
    }

    return form;
}

So, you would pass it the path you are about to forward to, set the
properties on the bean, and send it along. 

If you do it this way, just be sure that the reset method doesn't whack
the properties you preset. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/> On Fri, 2002-02-15 at 14:04, Ted
Husted wrote:


Andreas Mack wrote:
> 

> > You might want to start with an ActionForm bean that represents the OK
> > dialog page.
> >
> > This should include properties for a base forward and for a paramId and
> > param (like the html:link tag).
> >
> > The Action for the OK button would then look for the given forward,
> >
> > ActionForward baseForward = mapping.findForward(okForm.getForward());
> >
> > and create a new forward, with the paramId and param properties,
> > something like
> [...]
> 
> Hi Ted,
> 
> thanks for the suggestion.
> I've implemented it, but I faced the difficulty to get the info
> into the form in the first place. I mean I am in an Action class and
> want to direct to the okdialog. The ActionForm doesn't exist yet, right?
> 
> My solution is to set those infos (forward, message, paramId etc) as
> request.attributes. In the validate method of the form I do sth like
>         if (forward == null) {
>                 forward = (String)request.getAttribute("forward");
>         }
>         if (message == null) {
>                 message = (String)request.getAttribute("message");
>         }
> 
> Would that be ok or are there other ways ?
> 
> --
> Andreas Mack <[EMAIL PROTECTED]>
> mediales. GmbH http://www.mediales.de
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

Reply via email to