spring mvc 接收页面表单List 怎么处理
需求:我们可以看出一个商品对应多个SKU 一个SKU又有两种不同的优惠方案,即优惠价格和折扣率。form 一次性提交,springmvc怎么处理呢?根据页面,我们可以封装一个goods对象,goods对象里面有个SKU的集合。如下图:public class Goods implements Serializable{int i
需求:

我们可以看出一个商品对应多个SKU 一个SKU又有两种不同的优惠方案,即优惠价格和折扣率。
form 一次性提交,spring mvc怎么处理呢?
根据页面,我们可以封装一个goods对象,goods对象里面有个SKU的集合。如下图:

public class Goods implements Serializable{
int id; //
List<SKU> skuList;SKU对象:

public class SKU implements Serializable{
int id;
String name;
int goodsId; //商品id
BigDecimal price; //优化价格
double DiscountRate ;///折扣率 jsp页面:


具体如下:
使用到了rowspan进行行合并的。
<form action="/saveByForm" method="post"> <table width="100%" border="1"> <tr> <th>商品idth</th> <th>商品规格</th> <th>优化政策</th> </tr> <tr> <td rows
原创不易,完成人机校验,阅读全文