• 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

Struts2 Populate ArrayList from JSP

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone, I'm new to struts2 and I'm having trouble getting data entered into an html form to populate an ArrayList the way I want it to when I delete a row from an html table that holds input fields that are populated from the ArrayList. Instead of populating every element in the ArrayList it leaves a null Element in the ArrayList where the row was deleted. I'm converting my application from a struts 1.2.7 application and the behavior in 1.2.7 was to fill in all the elements in the ArrayList and not leave nulls where the row was removed. I don't want to have to change my application to deal with these null rows or write code to remove them if there is a way to get struts2 to behave the way struts 1 did.

Maybe this example will make what I'm saying more clear:

JSP


And the row is being deleted on the screen by javascript that looks like this:


If the iterator loops 5 times and puts 5 hidden fields on the screen and the javascript is called to delete the third one then when the form is submitted the ArrayList will have elements in its first two and list two positions, but the third position will be null.

Please let me know if there is a way around this. Also, if someone could point me to a description of how struts2 process when it moves data from an html form to java fild that would be helpful as well.

Thanks
Tom
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found my problem, I'm new to java 6 (and 5 for that matter) I wasn't using the generics notation consistently.
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile 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