• 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

How do you handle the auto-population of collection of data from dynamic pages?

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

I have a few pages where in my JSP pages I loop through a List<SomeType> and for each, I build up a set of <s:..> elements. Typically I do something like:

<s:select list="states" name="pageBean.stateSelections[<%= cntr %>].selectionId">....</s:select>.

I am wondering if this is the correct way to handle the form generation.. in my action class that the form submits to, I have a variable, PageBean, that has a property Collection<State> stateSelections. Each State object has a selectionId property in it. I am having some difficulties in getting this to work, so wanted to make sure this is the right way.

Thanks.
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean pre population? Are you doing this in struts 2 ?
 
john lazeraski
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If pre population is when the form submits and struts figures out the nested objects within the action class using reflection to set the form fields onto objects, then yes. Yes, this is using Struts 2.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to populate some data before submitting your action you should use Preparable interceptor Which will take care populating the data.

Refer the following link http://struts.apache.org/2.0.14/docs/prepare-interceptor.html
 
john lazeraski
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You know, I am using annotations for all my actions and such.. and I can't seem to find a good reference or tutorial that shows how to mix and match the interceptor stack configuration with annotations. I never quite fully got the whole interceptor stack thing and how to make use of it.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic