Java spring mvc动态列表绑定特定值变为空

Java spring mvc动态列表绑定特定值变为空,java,spring,spring-mvc,dynamic-list,Java,Spring,Spring Mvc,Dynamic List,我有一个非常奇怪的问题。我正在用Java和SpringMVC开发一个web应用程序。我有一行,用户只需按一个按钮就可以动态复制。每行大约有10个字段。我将这些行绑定为支持bean中的对象列表,并将该列表初始化为bean中的惰性列表。现在,它一直工作正常,但用户尝试输入12行,在第12行,即第11次迭代(从0开始的迭代),第5个字段变为空,尽管用户输入值,所有其他字段保留其值。由于绑定是使用name进行的,所以我检查了字段的名称,它与同一行中的其余字段以及其余行一致。我无法调试和纠正该问题。这会影

我有一个非常奇怪的问题。我正在用Java和SpringMVC开发一个web应用程序。我有一行,用户只需按一个按钮就可以动态复制。每行大约有10个字段。我将这些行绑定为支持bean中的对象列表,并将该列表初始化为bean中的惰性列表。现在,它一直工作正常,但用户尝试输入12行,在第12行,即第11次迭代(从0开始的迭代),第5个字段变为空,尽管用户输入值,所有其他字段保留其值。由于绑定是使用name进行的,所以我检查了字段的名称,它与同一行中的其余字段以及其余行一致。我无法调试和纠正该问题。这会影响生产中的代码

我可以提供所需的任何代码片段

谁能帮帮我吗。提前谢谢

编辑:我尝试在不同的服务器上执行相同的代码,在那里工作正常,但在实时服务器上仍然存在。问题似乎只出现在第11次迭代的第5个字段中。可能是服务器有问题吗

添加代码:

JSP:

豆子:

私有列表要求;
//在构造函数中
要求=LazyList.com(
新ArrayList()
,新的实例化因子(RequirementBean.class));
控制器:

@RequestMapping(value="/addProposal", method=RequestMethod.POST)
public String addProposal(@ModelAttribute("addProposal") ProposalBean proposal, ModelMap model){
    RequirementBean req;
    List<RequirementBean> reqmtList;

    System.out.println("Before empty rows");
    reqmtList = proposal.getRequirements();
    for(int i=0; i<reqmtList.size(); i++){
        req = reqmtList.get(i);
        if(req.getCountry()!=null){
            System.out.println("sample size " + i + " :" + req.getSampleSize());
        }
    }
}
@RequestMapping(value=“/addProposal”,method=RequestMethod.POST)
公共字符串addProposal(@modeldAttribute(“addProposal”)ProposalBean proposal,ModelMap model){
需求bean请求;
列表要求列表;
System.out.println(“空行前”);
reqmtList=提案。getRequirements();

对于(int i=0;iOne没有代码就无法发现此类问题。-因此,是的,请发布代码片段。@Ralph:我已经检查了提交时jsp中的字段中是否存在值。但是当对象到达控制器时,字段为空。那么,我应该发布什么代码?您还检查了提交http请求吗?这些值是否显示在jsp中此请求?(例如使用Firebug网络监视器)@Ralph我更改了同一行中第四个字段的值,现在它可以工作了。我仍然无法找出问题所在
$(document).ready(function(){

    //Add more dynamic rows
        $("#addMore").click(function() {    
             var tr_temp=$("#requirement tr:first").clone();
             //rest of the fields code
             tr_temp.find("#r_sample0").each(function() {
                 $(this).attr({
                        'id': function(_, id) { return 'r_sample' + i},
                        'name': function(_, name) { return 'requirements[' + i + '].sampleSize'},
                        'value': ''
                });
                }).end();
             tr_temp.find("td:last").remove();
             tr_temp.append(btn_close);
             tr_temp.appendTo("#requirement");
             i++;                       
        });

        //To remove a dynamically added row
        $("#btn-close").live('click',function(){
            doNotDel=false;
            count=0;

            //To fetch the values of the Input Fields
            $(this).parent().find("input").each(function(){
                count++;
                var value = $(this).val();
                var id=$(this).attr('id');              
                if(id.indexOf("r_total")==-1){
                    //Skip the minutes and currency column
                    if(id.indexOf("minutes")==-1 && id.indexOf("currencyValF")==-1 && id.indexOf("currencyVal")==-1){
                        if(value!=""){
                            doNotDel=true;
                            return false;       //breaks the .each loop
                        }                       
                    }
                }
            });

            if(doNotDel==false){
                $(this).parent().remove();  
            }               
        });
});
private List<RequirementBean> requirements;

//in constructor
requirements = LazyList.decorate(
                new ArrayList<RequirementBean>()
                , new InstantiateFactory(RequirementBean.class));
@RequestMapping(value="/addProposal", method=RequestMethod.POST)
public String addProposal(@ModelAttribute("addProposal") ProposalBean proposal, ModelMap model){
    RequirementBean req;
    List<RequirementBean> reqmtList;

    System.out.println("Before empty rows");
    reqmtList = proposal.getRequirements();
    for(int i=0; i<reqmtList.size(); i++){
        req = reqmtList.get(i);
        if(req.getCountry()!=null){
            System.out.println("sample size " + i + " :" + req.getSampleSize());
        }
    }
}