The best solution here is to use add a switch to your bean to make its
properties immutable. 

private boolean immutable = false;
public void setImmutable(boolean immutable) { 
    this.immutable = immutable;
}

// ...

public setProperty(String property) {
    if (immutable) exit;
    this.property = property;

If you set this before forwarding the bean, then reset and autopopulate
will have no affect. 

(Unless, of course, reset sets the fields directly. In which case, reset
needs to observe immutable, or use the setters instead.)

For the nightly build, I've suggested that we add two new methods so
that one Action can invoke another, but need some people to test the
idea for me. (Since I don't do this sort of thing myself.)

This would let you do things like 

// ...
ActionForward forward = 
    servlet.invokeAction("/item/Edit",form,request,response);
return forward;

To create a new ActionForm to use with invokeAction, you could call 

ActionForm secondForm = 
    servlet.createActionForm("/item/Edit");
and then populate it as you would any ActionForm:
ActionForward forward = null;
if (secondForm==null) {
    // .. cope with error 
}
else {
    EditForm editForm = (EditForm) secondForm;
    editForm.setArticle("17");
    editForm.setTitle("Change Me");
    forward = invokeAction(
        "/item/Edit",editForm,request,response);
}
// ...
return forward;

If anyone is interested, I can post a patched JAR. But then they really,
really need to tell me that it works, or else this will never be
committed. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/



Joe Faith wrote:
> 
> Hi,
> 
> I want to 'chain' actions, by setting the forward of one to be
> 'my_action.do'
> The problem is that this resets the action form before calling the next
> action.
> Is there anyway to prevent this, or am I chaining actions in the wrong
> way?
> 
> thanks
> 
> --
> Joe Faith
> http://www.runtime-collective.com
> T: (+44) 01273 234294
> M: (+44) 07968 292064

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

Reply via email to