Guest User

Untitled

a guest
Aug 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. I am unable to form table in List<String> using struts 2 tags
  2. public class IteratorAction extends ActionSupport{
  3.  
  4. private List<String> list;
  5.  
  6. public List<String> getList() {
  7. return list;
  8. }
  9.  
  10. public void setlist(List<String> list) {
  11. this.list= list;
  12. }
  13.  
  14. public String execute() {
  15.  
  16. list= new ArrayList<String>();
  17. list.add("A");
  18. list.add("B");
  19. list.add("C");
  20. list.add("D");
  21. list.add("E");
  22. list.add("F");
  23.  
  24. return SUCCESS;
  25. }
  26. }
  27.  
  28. <table>
  29. <s:iterator value="list" status="listStatus">
  30. <tr>
  31. <s:if test="#listStatus.even == true">
  32. <td style="background: #CCCCCC"><s:property/></td>
  33. </s:if>
  34. <s:elseif test="#listStatus.first == true">
  35. <td><s:property/> (This is first value) </td>
  36. </s:elseif>
  37. <s:else>
  38. <td><s:property/></td>
  39. </s:else>
  40. </tr>
  41. </s:iterator>
  42. </table>
Add Comment
Please, Sign In to add comment