Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Trapping User selection for dynamically generated elements

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,
I will try and explain what I am trying to do :
To reach the first UI screen I am getting records from the database
So I do not know the size of the records
This I want to populate on the JSP
Against each of these records - I intend to use a checkbox
user can then select the records he / she desires
Then user can submit the from

The problem is - I am not sure about the approach I need to follow to
find which records the user had selected

I may be confusing you folks -
so here is the code that I have

The variable - " searchSubForm " contains an array - each JavaBean encapsulates the database record.

In the JSP - the code to show the data on ui is :


However when I am posting the same form the subform array is null

My form is in request scope
In such cases is it required that I place the form on session ?

Any help would be greatly appreciated

Thanks in advance ,
-satish
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you have an array of data, u need to use
"Struts Indexed Properties".
Try google for examples of this...
 
satish pune
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply

However - I have not been able to make progress

I have changed the scope of the form bean to session

As a result - the subform array is now populated with three elements

I am also able to see the three elements on the JSP

I am showing a checkbox and a text box

However - whenever I submit the form - only the reset method of the form bean is getting invoked and then directly the action class

None of the setters of the subform alements is getting invoked

Is this in someway related to the iteration ?

Thanks in advance,
-satish
 
You have to be odd to be #1 - Seuss. An odd little ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic