File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes table with editable fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "table with editable fields" Watch "table with editable fields" New topic
Author

table with editable fields

suni george
Greenhorn

Joined: Apr 23, 2008
Posts: 2
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.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30753
    
156

"sg",
Please check your private messages about an important administrative matter.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
suni george
Greenhorn

Joined: Apr 23, 2008
Posts: 2
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: table with editable fields