You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Peters <tp...@aidera.com> on 2001/05/29 18:06:37 UTC

bean attributes not displaying - please help

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>


Re: Solution: bean attributes not displaying (please comment)

Posted by Thomas Peters <tp...@aidera.com>.
Thank you...

True, it is configurable, I see that.

So the ActionMapping object's getAttribute() method returns the name of the
'key' used to store the form bean, in this case an if block is used to
return the scope first, which determine where the form bean, references by
this mapping, passed into the perform method, has been stored.

Is that right?


----- Original Message -----
From: "Martin Cooper" <ma...@tumbleweed.com>
To: <st...@jakarta.apache.org>; "Thomas Peters" <tp...@aidera.com>
Sent: Thursday, May 31, 2001 12:01 AM
Subject: Re: Solution: bean attributes not displaying (please comment)


> Actually, the getAttribute() method returns the name of the attribute used
> to store the form bean, not the mapping. The mapping is maintained
> internally within the Struts controller, and is not saved under an
> attribute.
>
> Also, the form bean may be in request scope or session scope. This is
> configurable in struts-config.xml.
>
> --
> Martin Cooper
>
>
> ----- Original Message -----
> From: "Thomas Peters" <tp...@aidera.com>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, May 30, 2001 8:45 AM
> Subject: Re: Solution: bean attributes not displaying (please comment)
>
>
> > The struts documentation indicates that 'mapping.getAttribute()' returns
> the
> > mapping name. In the case of the perform method in an Action instance,
> this
> > is a passed in property.
> >
> > Therefore, 'request.removeAttribute(mapping,getAttribute())' removes the
> > stored attribute from the request context where attribute is the name of
> the
> > mapping.
> >
> > This would have been stored in the request context in some previous
step.
> > However, in the case that the mapping.getScope() doesn't return
'request'
> it
> > is removed from the session scope.
> >
> >
> > ----- Original Message -----
> > From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> > To: <st...@jakarta.apache.org>
> > Sent: Wednesday, May 30, 2001 12:12 AM
> > Subject: Solution: bean attributes not displaying (please comment)
> >
> >
> > > Got it:  My problem resided in these lines of code in perform() (which
I
> > > copied from an Action class in the struts-example):
> > >
> > >        if (mapping.getAttribute() != null) {
> > >            if ("request".equals(mapping.getScope()))
> > >                request.removeAttribute(mapping.getAttribute());
> > >            else
> > >                session.removeAttribute(mapping.getAttribute());
> > >        }
> > >
> > > So my question to the list is: what exactly are these lines doing?
> > >
> > > Thanks,
> > > Martin
> > >
> > > Thomas Peters wrote:
> > > >
> > > > Thanks for your reply...
> > > >
> > > > I guessed that was the problem. I don't see the new instance being
> > created
> > > > in my log file. I also have a fully working struts demo, which does
> not
> > > > display this behavior. What's up with that?
> > > >
> > > > Tom
> > > >
> > > > ----- Original Message -----
> > > > From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> > > > To: <st...@jakarta.apache.org>
> > > > Sent: Tuesday, May 29, 2001 6:49 PM
> > > > Subject: Re: bean attributes not displaying - please help
> > > >
> > > > > 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
> > > > >
> > >
> > > --
> > > Martin Zaidel,
> > > Senior Software Engineer
> > > Cortex eBusiness P/L, Melbourne
> > > www.cortexebusiness.com.au
> > >
> >
>
>
>


Re: Solution: bean attributes not displaying (please comment)

Posted by Martin Cooper <ma...@tumbleweed.com>.
Actually, the getAttribute() method returns the name of the attribute used
to store the form bean, not the mapping. The mapping is maintained
internally within the Struts controller, and is not saved under an
attribute.

Also, the form bean may be in request scope or session scope. This is
configurable in struts-config.xml.

--
Martin Cooper


----- Original Message -----
From: "Thomas Peters" <tp...@aidera.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, May 30, 2001 8:45 AM
Subject: Re: Solution: bean attributes not displaying (please comment)


> The struts documentation indicates that 'mapping.getAttribute()' returns
the
> mapping name. In the case of the perform method in an Action instance,
this
> is a passed in property.
>
> Therefore, 'request.removeAttribute(mapping,getAttribute())' removes the
> stored attribute from the request context where attribute is the name of
the
> mapping.
>
> This would have been stored in the request context in some previous step.
> However, in the case that the mapping.getScope() doesn't return 'request'
it
> is removed from the session scope.
>
>
> ----- Original Message -----
> From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, May 30, 2001 12:12 AM
> Subject: Solution: bean attributes not displaying (please comment)
>
>
> > Got it:  My problem resided in these lines of code in perform() (which I
> > copied from an Action class in the struts-example):
> >
> >        if (mapping.getAttribute() != null) {
> >            if ("request".equals(mapping.getScope()))
> >                request.removeAttribute(mapping.getAttribute());
> >            else
> >                session.removeAttribute(mapping.getAttribute());
> >        }
> >
> > So my question to the list is: what exactly are these lines doing?
> >
> > Thanks,
> > Martin
> >
> > Thomas Peters wrote:
> > >
> > > Thanks for your reply...
> > >
> > > I guessed that was the problem. I don't see the new instance being
> created
> > > in my log file. I also have a fully working struts demo, which does
not
> > > display this behavior. What's up with that?
> > >
> > > Tom
> > >
> > > ----- Original Message -----
> > > From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> > > To: <st...@jakarta.apache.org>
> > > Sent: Tuesday, May 29, 2001 6:49 PM
> > > Subject: Re: bean attributes not displaying - please help
> > >
> > > > 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
> > > >
> >
> > --
> > Martin Zaidel,
> > Senior Software Engineer
> > Cortex eBusiness P/L, Melbourne
> > www.cortexebusiness.com.au
> >
>



Re: Solution: bean attributes not displaying (please comment)

Posted by Thomas Peters <tp...@aidera.com>.
The struts documentation indicates that 'mapping.getAttribute()' returns the
mapping name. In the case of the perform method in an Action instance, this
is a passed in property.

Therefore, 'request.removeAttribute(mapping,getAttribute())' removes the
stored attribute from the request context where attribute is the name of the
mapping.

This would have been stored in the request context in some previous step.
However, in the case that the mapping.getScope() doesn't return 'request' it
is removed from the session scope.


----- Original Message -----
From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
To: <st...@jakarta.apache.org>
Sent: Wednesday, May 30, 2001 12:12 AM
Subject: Solution: bean attributes not displaying (please comment)


> Got it:  My problem resided in these lines of code in perform() (which I
> copied from an Action class in the struts-example):
>
>        if (mapping.getAttribute() != null) {
>            if ("request".equals(mapping.getScope()))
>                request.removeAttribute(mapping.getAttribute());
>            else
>                session.removeAttribute(mapping.getAttribute());
>        }
>
> So my question to the list is: what exactly are these lines doing?
>
> Thanks,
> Martin
>
> Thomas Peters wrote:
> >
> > Thanks for your reply...
> >
> > I guessed that was the problem. I don't see the new instance being
created
> > in my log file. I also have a fully working struts demo, which does not
> > display this behavior. What's up with that?
> >
> > Tom
> >
> > ----- Original Message -----
> > From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> > To: <st...@jakarta.apache.org>
> > Sent: Tuesday, May 29, 2001 6:49 PM
> > Subject: Re: bean attributes not displaying - please help
> >
> > > 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
> > >
>
> --
> Martin Zaidel,
> Senior Software Engineer
> Cortex eBusiness P/L, Melbourne
> www.cortexebusiness.com.au
>


Solution: bean attributes not displaying (please comment)

Posted by Martin Zaidel <ma...@cortexebusiness.com.au>.
Got it:  My problem resided in these lines of code in perform() (which I
copied from an Action class in the struts-example):

       if (mapping.getAttribute() != null) {
           if ("request".equals(mapping.getScope()))
               request.removeAttribute(mapping.getAttribute());
           else
               session.removeAttribute(mapping.getAttribute());
       }

So my question to the list is: what exactly are these lines doing?

Thanks,
Martin

Thomas Peters wrote:
> 
> Thanks for your reply...
> 
> I guessed that was the problem. I don't see the new instance being created
> in my log file. I also have a fully working struts demo, which does not
> display this behavior. What's up with that?
> 
> Tom
> 
> ----- Original Message -----
> From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
> To: <st...@jakarta.apache.org>
> Sent: Tuesday, May 29, 2001 6:49 PM
> Subject: Re: bean attributes not displaying - please help
> 
> > 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
> >

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

Re: bean attributes not displaying - please help

Posted by Thomas Peters <tp...@aidera.com>.
Thanks for your reply...

I guessed that was the problem. I don't see the new instance being created
in my log file. I also have a fully working struts demo, which does not
display this behavior. What's up with that?

Tom

----- Original Message -----
From: "Martin Zaidel" <ma...@cortexebusiness.com.au>
To: <st...@jakarta.apache.org>
Sent: Tuesday, May 29, 2001 6:49 PM
Subject: Re: bean attributes not displaying - please help


> 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
>


Re: bean attributes not displaying - please help

Posted by Martin Zaidel <ma...@cortexebusiness.com.au>.
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