wood burning stoves 2.0*
The moose likes Struts and the fly likes how to obtain list object from an actionform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to obtain list object from an actionform" Watch "how to obtain list object from an actionform" New topic
Author

how to obtain list object from an actionform

krizel clemente
Greenhorn

Joined: May 30, 2007
Posts: 5
Hi,

I'm having problem in getting the list object from the actionform.
It returns null value.

my actionform look likes this:


my action class is looks like this:


my customer bean:



snippet of my struts-config.xml:



my jsp snippet is like this:



scenario: bean customer is pre-populated and been able to display on the page.

problem, i would like to retrieve the form from the page and obtain the values, im able to get the transactionNumber and transactionLocation but when i obtain the list, it returns 0 as the size.

Is there anyone that can help me? i need to obtain the list object that has been populated.

[ July 23, 2007: Message edited by: krizel clemente ]
[ July 23, 2007: Message edited by: krizel clemente ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This question belongs in the Struts forum. I'm moving it there for you.


Merrill
Consultant, Sima Solutions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The technique you're attempting to use is referred to as "indexed properties". If you check out question 6 of the JavaRanch Struts FAQ you'll find a lot of good information about this topic, as well as a working example.

Regarding your example, you're almost there. Just change your JSP as follows:


The trick is that the id of your logic:iterate must have the same name as your indexed property, which in this case is customers.

Also, the setter in your ActionForm must be changed. It should look like this:

[ July 23, 2007: Message edited by: Merrill Higginson ]
krizel clemente
Greenhorn

Joined: May 30, 2007
Posts: 5
hi,

your code works, thanks for the tip...

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to obtain list object from an actionform