Struts 2: updating a list of objects from a form with model driven architecture

后端 未结 5 2136
一个人的身影
一个人的身影 2020-12-19 11:58

I already searched and found several approaches here, but I can\'t get them working for my project.

I want to show an edit page for a list of objects, which should

5条回答
  •  醉酒成梦
    2020-12-19 12:33

    Thanks to all of you getting along with this issue! Your hints were most useful. I finally got it up and running rewriting everything from the scratch. I can edit my models now using the following Action-Class:

    public class TeilzeitgradEditAction implements ModelDriven> {
    
    List teilzeitgrads;
    private String tzgTypKey;
    private Integer jahr;
    
    public String execute() {
        return SUCCESS;
    }
    
    @Override
    public List getModel()
    {
        if(teilzeitgrads == null) {
            teilzeitgrads = getTeilzeitgradListByTypAndJahr(tzgTypKey, jahr);
        }
    
        return teilzeitgrads;
    }
    
    public List getTeilzeitgrads()
    {
        return teilzeitgrads;
    }
    
    public void setTeilzeitgrads(List teilzeitgrads)
    {
        this.teilzeitgrads = teilzeitgrads;
    }
    
        // getters and setters for local attributes
    }
    

    and this JSP-Code:

    
    
    
        
            
            
        
    
    
    
    

    Thanks a lot for your support!

    Cheers, Lenzo

提交回复
热议问题