Struts logic:iterate input field

后端 未结 4 2066
悲哀的现实
悲哀的现实 2021-01-03 07:37

I currently have the following code and the data is displayed fine.



        
4条回答
  •  长情又很酷
    2021-01-03 07:57

    I think Th0rndikes answer is mostly correct. My implementation is slightly different, so it might be worth trying this as well.

    Form

    private List activeParameters;
    
    public List getActiveParameters() {
        return activeParameters;
    }
    
    public Parameter getParam(int index){
        return this.activeParameters.get(index);
    }
    

    JSP

    
      
        
        
      
    
    

    In summary, I didn't use Type in the iterate tag, using the property tag instead. In the bean adding a getter with matched the name of the iterate ID in the JSP (param) with an index as a method parameter did the trick.

提交回复
热议问题