struts2 nested list attribute, receiving the parameters passed by the page

There is a nested list attribute List<List<Entity class>> ordprQtyVo in the action of struts2;

There are two attributes in the entity class: productId, productName

 

The jsp page sets the hidden field:

<input type="hidden" name="ordprQtyVo[0][0].productId" value="${item.productId}"/>

 

In this way, when we submit the form, ordprQtyVo cannot receive any parameter values.

 

solution:

Let's create a new entity class, which I call entity class VO. The entity class VO contains a list attribute, such as:

private List<entity class> voList ;

The nested list attribute of the action class is changed to this List<entity class VO> ordprQtyVo;

Then the hidden field of our page is changed to this:

<input type="hidden" name="ordprQtyVo[0].voList[0].productId" value="${item.productId}"/>

 

In this case, when the form is submitted, the action layer can receive the parameter value.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326653482&siteId=291194637