• 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 can i save the state of checkboxes in the jsp to action class in struts2?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jsp having multiple checkboxes in a table. The whole view is being populated dynamically from database(state of checkboxes name of the checkboxes etc.)
I used A model for my form and it contains menuList In have a List of B type which I set manually inside action class. And iterating over the List in jsp and set the status of checkboxes in jsp. The problem is when i click on save button the setter method of menuList should be called but it is showing me menuList as null..

Following is my code:-
Form Bean Class:-


Class B:-



Jsp:-



Action class:-

 
Ankit Duggal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey Anybody here please help me...


Ankit Duggal
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. We are all volunteers here, answering questions in our spare time so we ask that you be patient if someone doesn't drop everything to assist you an hour after you post.
If you want to populate a List from a JSP page, you have to use indexed properties so Struts knows how to rebuild the list (yes, that link is for Struts 1.3, but the principle still applies in Struts 2.x).
 
Ankit Duggal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your Time And reply Joe Ess:-

But I dont know about the indexed properties as such so can please give example specific to my query.. and more to the point...

Thanks and regards
Ankit
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you search, you'll find many examples, like this one on this very site.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic