Struts 2 nesting iterators

后端 未结 4 690
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 22:06

I can\'t believe how something this simple can seem so hard to do in Struts 2.

This is approximately what I would like to do as it would be done in Java.

         


        
4条回答
  •  悲哀的现实
    2020-12-03 22:51

    This is how the JSP code will look like:

        
            
                
                
                
                
                    
                
            
            
        
    

    Following is the bean(XBean) whose List is used in the JSP:

    public class XBean
    {    
    private ArrayList lstString=new ArrayList();
    private String name;
    private Double amt;
    private Integer id;
    //Getters and setters of fields
    }
    

    Now you can simply have a field lstBean with setters in your submitting action (saveaction) and hey you are done.

提交回复
热议问题