Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.96 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Re-populate struts2 checkboxlist data from database
  2. <s:checkboxlist list="{'Mon','Tue','Wed','Thur','Fri','Sat','Sun'}"   name="modProcessVO.weeklyCal" id="days" />`.
  3.        
  4. `<s:checkboxlist list="{'Mon','Tue','Wed','Thur','Fri','Sat','Sun'}"
  5. name="modProcessVO.weeklyCal" value="%{wordList}" id="days" />`.
  6.        
  7. private String[] wordList ;
  8.        
  9. private String[] checkedItems;
  10. checkedItems = new String[]{"Mon","Tue","Wed"};
  11.        
  12. <s:checkboxlist list="checkboxListIs" name="checkedItem" value="checkedItems" label="Days"></s:checkboxlist>
  13.        
  14. public class ScheduleAction extends ActionSupport {
  15.        
  16. private List<String> wordList;
  17.  
  18. public String modifySchedule() {
  19. checkListData = modProcessVO.getCalWeek(); // retrieving checked items from database
  20.     String regex=",";
  21.     String[] test=checkListData.split(regex);
  22.     wordList = new ArrayList<String>();
  23. for(String str : test)
  24.     {
  25.         wordList.add(str.trim());
  26.     }
  27. return SUCCESS;
  28. }
  29. //getters and setters of variables
  30.  
  31. }