使用ModelDriven Interceptor,请求参数未映射到Struts 2中的Model类

时间:2019-08-19 19:07:13

标签: jsp hashmap struts2 model-driven

在JSP中向Struts 2动作类提交表单时,无法正确创建ModelDriven对象。仅填充某些字段,而不填充其他字段。

以下是使用post方法提交给Action类的参数:

orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.vendor.vendorName: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.vendor.number: 10065
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.vendor.vendorDeptNumber: 0
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.masterVendor.vendorName: 10064
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.masterVendor.number: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.masterVendor.vendorDeptNumber: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityName: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityNumber: 5023
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityBUID: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.isValid: true

模型对象:

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;


public class OrderDaysForm {



    private Map<String, OrderDayDisplay> orderDaysMap = null;


    public Map<String, OrderDayDisplay> getOrderDaysMap() {
        return orderDaysMap;
    }
    public void setOrderDaysMap(Map<String, OrderDayDisplay> orderDaysMap) 
    {
        this.orderDaysMap = orderDaysMap;
    }


}
public class OrderDayDisplay implements Exportable, java.io.Serializable {
    private static final long serialVersionUID = 20070403092401L;

    private Map<String, OrderDayRecord> orderDayMap;

    public Map<String, OrderDayRecord> getOrderDayMap() {
        return orderDayMap;
    }
    public void setOrderDayMap(Map<String, OrderDayRecord> m) {
        this.orderDayMap = m;
    }



}
public class OrderDayRecord extends OrderDay implements Exportable {

    private static final long serialVersionUID = 20070403105701L;

}
public class OrderDay implements java.io.Serializable {

    private static final long serialVersionUID = 20070202142501L;
    private VendorFacility facility;

}

与以下请求参数相对应的VendorFacility对象未填充在OrderDayRecord类中:

orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityName: 
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityNumber: 5023
orderDaysMap['10065A5023'].orderDayMap['100655023299912319901566237468850'].facility.facility.facilityBUID: 

0 个答案:

没有答案