• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

table with editable fields

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to display a table which has editable fields and has the ability of adding new rows.

I am using <logic:iterate> to populate the input fields on the table. The ArrayList used is of type DataBean(another dto with 5 fields). My problem is that, i am not able to retrieve the data i enter on the screen as those fields are not directly related to the Form class for that form. Am i using a wrong approach or am i missing something. Please help.

Thanks,
sg.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"sg",
Please check your private messages about an important administrative matter.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need to use "indexed properties" for this. For information on how to do this along with a simple example, see question 7 of this forum's FAQ.
 
suni george
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. I tried using the indexed properties and i am not getting it to work. This is what i did:

1.Added into the struts config file form-property:
<form-bean name="enterDataForm" type = "mypkg.EnterDataForm">
<form-property name="sampleData" type="mypkg.dto.DataBean[]"/></form-bean>

2.Added in the jsp files the 'indexed=true' property

3.Added in the EnterDataForm class, new setter & getter: - sampleData is an Array of DataBean and has its regular setter and getter function too.

public DataBean getSampleData(int index)
{
return sampleData[index];
}

public void setSampleData(int index, DataBean b)
{
sampleData[index]=b;
}


Is there something else i need to do?

[ April 24, 2008: Message edited by: suni george ]
[ April 24, 2008: Message edited by: suni george ]
 
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. 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