Hi Sven,

At as guess, you are not putting the form back into scope, try something
like this in your findEntity action...

if (mapping.getName() != null) 
{
        if ("request".equals(mapping.getScope()))
      {
        request.setAttribute(mapping.getName(), form);
      }
      else
      {
                HttpSession session = request.getSession();
                session.setAttribute(mapping.getName(), form);
      }
}

This is a generic solution to putting forms into a scope defined in your
mapping, it assumes that the form name defined in the mapping is the form
used by the action you are forwarding to; if this isn't the case, explicitly
put the form into either the request or session scope under the appropriate
key (ie the form name as defined in your struts-config).

Jon Ridgway


-----Original Message-----
From: Efftinge, Sven [mailto:[EMAIL PROTECTED]] 
Sent: 11 July 2002 10:27
To: [EMAIL PROTECTED]
Subject: change an Actionform

Hi,
this is relative fundamental, but I haven't seen an answer in any
documentation or tutorial.

My Question is 'How can I change the Actionform in an Action?'
Description:
I do a request to findEntity.do and submit a SearchEntityForm.
With the values in it I try to find an entity in the backend and, on
success, forwarding to editEntity.jsp which is using the EditEntityForm.

I tried this:
        aValue = (SearchEntityForm) form;
        dataobjekt = EntityFassade.findByValue(aValue);
        // Change the Type of the form-object
        form = new EditEntityForm(); 
        form.setAnotherValue(dataobjekt.getAnotherValue());

result is:
        The typechange works but has no Data in it.
        All I see is an empty form in editEntity.jsp 
        
My struts-config looks like this:

   <action path="/findEntity.do" 
            type="FindEntityAction"
            name="SearchEntityForm" 
            scope="request" 
            input="/SearchEntity.jsp"
            validate="true" >

            <forward name="failure" path="/SearchEntity.jsp" />
            <forward name="success" path="/EditEntityForm.jsp" />
    </action>

I'm using Struts 1.1beta1

Thanks in advance 

Sven

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


The contents of this email are intended only for the named addressees and
may contain confidential and/or privileged material. If received in error
please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
e-mail from your system. Unauthorised review, distribution, disclosure or
other use of this information could constitute a breach of confidence. Your
co-operation in this matter is greatly appreciated. 

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

Reply via email to