This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

how to obtain list object from an actionform

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question belongs in the Struts forum. I'm moving it there for you.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

your code works, thanks for the tip...

 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic