Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to update data via list in Struts2

 
namehas beentaken
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everyone. I am new to Struts2, and I am trying to build a phone bill calcualte page. I use list to contain and successfully display them in the text fileds in jsp page. however, when I modify the data and submit, the action class does not catch anything and the list become null. Can anyone help me through it?
First, I declear a class PhoneMember which has my own attributes. (name, extra minutes cost ...) all of them are String type.
then, In action class I define the list and setter/getter
then I initial 5 elements and add them in the list. I also define a String parameter "total" for total cost.
later in jsp page, I use iterator
the initial value displayed successfully, but when I click the submit button, the phoneList in action class is null. all the data have been lost. But the "total" parameter receives the value;
Can any one helps me to solve this problem? I googled but can't find a solution. I also tried define another list in the action class and use that list name in the iterator. But neither lists get the data. Thanks very much
 
namehas beentaken
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, Nitin. Finally I find the reason, it is necessary to define an empty constructor in bean file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic