Win a copy of Spark in Action this week in the Open Source Projects 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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
  • 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
  • Quote
  • Report post to moderator
hey Anybody here please help me...


Ankit Duggal
 
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you search, you'll find many examples, like this one on this very site.
 
God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic