I also have this problem, but alas, no solution (as yet).  I've even
tried
in struts-config.xml to set the scope of the actions to "session", and
have explicitly
added the form to the session within the Action's perform().  I, too,
can see the form properly populated.  However, when the form's jsp is
called, a new Form instance is instantiated----thus, the displayed form
is blank.

Any ideas?

> Thomas Peters wrote:
> 
> I have a jsp page called 'customer.jsp' with a class call
> 'CustomerForm' which extendes ActionForm.
> 
> I have cut and paste my mappings and listed them below.
> 
> The application flow is such, that I have a link with a URI of
> /searchCustomers.do?action=Search. This action calls
> 'CustomerSearchAction' which initializes a 'CustomerForm' with null
> values for all the attributes except action, that's defaulted to
> 'Search'. That works fine.
> 
> When the end user completes and submits the 'CustomerForm' form, I
> construct a query that returns a list of customers matching the
> submitted criteria. 'Customers' is a class which contains a Hashtable
> of 'Customer' objects. This is accomplished with 'CustomerListAction'
> and forwards to 'customers.jsp' which presents the results in a list.
> I have a 'LinkCustomerTag' class which builds links within the
> iteration of 'customers' on the 'customers.jsp' page. The link looks
> like this: '/editCustomer.do?action=Edit&custNum=10' where
> 'custNum=10' dynamically changes throughout the iteration based on the
> current 'customer'. This works fine too.
> 
> I select one of the links in the list which maps to '/editCustomer'
> (see below) and calls the 'CustomerEditAction' class where I copy the
> properties to the instance of 'CustomerForm' and 'forward' to the
> 'customer.jsp'. This is where my problem is.
> 
>  ****** The form is blank. ******
> 
> I have lotts of comments in my code and can see that
> 'PropertyUtils.copyProrerties(customerForm, customer)' is getting
> called. I even modified the 'PropertyUtils' class to log the
> properties being copied within the 'Enumeration' in the
> 'copyProperties' method. You can see these values being copied into
> the 'ActionForm' but when the 'forward' is called and the
> 'customer.jsp' is displayed, it is empty.
> 
> Please help...
> 
> 
> ########################
> struts-config.xml
> ########################
> 
> 
>   <!-- ========== Form Bean Definitions
> =================================== -->
> 
>     <!-- Customer form bean -->
>     <form-bean      name="customerForm"
>                     type="CustomerForm"/>
> 
>     <!-- Customer list bean -->
>     <form-bean      name="customerList"
>                     type="CustomerForm"/>
> .
> .
> .
> .
> 
>   <!-- ========== Action Mapping Definitions
> ============================== -->
>     <!-- Search customer -->
>     <action    path="/searchCustomer"
>                type="CustomerSearchAction"
>                name="customerForm"
>               scope="request"
>               input="/customer.jsp">
>       <forward name="success"         path="/customer.jsp"/>
>     </action>
> 
>     <!-- List customers -->
>     <action    path="/listCustomers"
>                type="CustomerListAction"
>                name="customerList"
>               scope="request">
>       <forward name="success"         path="/customers.jsp"/>
> 
>     </action>
> 
>     <!-- Edit customer -->
>     <action    path="/editCustomer"
>                type="CustomerEditAction"
>                name="customerForm"
>               scope="request"
>            validate="false">
>       <forward name="failure"              path="/customers.jsp"/>
>       <forward name="success"              path="/customer.jsp"/>
>     </action>

-- 
Martin Zaidel,
Senior Software Engineer
Cortex eBusiness P/L, Melbourne
www.cortexebusiness.com.au

Reply via email to