• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with Indexed Properties - Repost  RSS feed

 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm trying to rebuild the question. I'm sorry if I'm ambigous in forming
the question. The core of the issue is not being able to understand how to
use the indexed property and in which form.
I have DataLineDetail bean representing one row of data. I'm trying to
expose this bean's some of the fields as editable. I have DetailSubmitForm
which encapsulates an ArrayList of DataLineDetail bean and provides indexed
properties as shown below.

My struts-config file looks something like this.

DetailAction which puts an ArrayList of DataLineDetail bean in session
scope, is something like this.

Request is forwarded to a jsp page which has the following code

Here I think I'm supposed to use the indexedLineDetail property of the
Form, but how I'm not being able to figure out.
And then I have DetailSubmitAction, which should validate the data against
business logic and forward the same updated Collection to a simple display
page to get final confirmation from the user before it gets written to the
database.
Now the problem is the collection is not getting updated. I have checked
the ArrayList in the DetailSubmitAction itself. I'm still getting the
original collection.
Any ideas, as to where am I going wrong? This entire issue has taken
my good amount of time.
Regards,
Kinjal sonpal
[ April 03, 2004: Message edited by: Kinjal Sonpal ]
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
At last I've found where I was going wrong! In <logic:iterate>,
the value of the id attribute should match the name of the indexed
property of the wrapper bean. The same applies to other html controls
nested inside the iterate tag as well.
It's okay to have some other nonmatching value, in case one has read-only
requirement (something like <bean:write> ). But if you have indexed
form controls, then it's a mandatory requirement to have matching. And it
seems now pretty logically correct as well.
Although there are numourous tutorial and sample examples, since I myself
have gone through the hardship, I think very soon I'll put the sample code
and some amount of basic desciption on the my web home, so that it can be
helpful to others. Once I prepare the things in a little more nice form,
I'll post the URL in here.
Regards,
Kinjal Sonpal
[ April 03, 2004: Message edited by: Kinjal Sonpal ]
 
Rick Hightower
Author
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good job. I've done that many times before. Spending time putting together a question.... some times yields an answer.... at least it always yields a better understanidng of the problem.
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Yes that's absolutely true. Infact, since around a month I've been
working on struts based technology. And 9 out of 10 times, while I'd form
my question, I'd get an answer.
Regards,
Kinjal Sonpal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!