两种jsp获得action传过来的值
第一种:
<s:iterator value="#pagination.datas" var="supplier" status="s">
<tr>
<%-- ${pagination.datas}得不到值 --%>
<%-- ${supplier}得不到值 --%>
<%-- <s:property value="#supplier"/> --%>
<td><input type="checkbox" name="IDCheck" value="<s:property value="#supplier.supplierId"/>" class="acb" /></td>
<td><s:property value="#supplier.supplierName"/></td>
<td><s:property value="#supplier.abbreviation"/></td>
<td><s:property value="#supplier.legalPerson"/></td>
<td><s:property value="#supplier.address"/></td>
<td><s:property value="#supplier.telephone"/></td>
<td><s:property value="#supplier.credibility"/></td>
<td><a href="archiv/supplier_edit?supplierId=<s:property value="#supplier.supplierId"/>" id="edit">编辑</a>
<a href="javascript:del('<s:property value="#supplier.supplierId"/>','${pagination.pageIndex}');">删除</a>
<a href="archiv/supplier_detail?supplierId=<s:property value="#supplier.supplierId"/>" id="detail">详情</a>
</td>
</tr>
</s:iterator>
原因:红色的那块,action中的supplier 再有modelDriven的基础上还加了getter和setter方法。删掉就可以使用方法二了
方法二:
<s:iterator value="#pagination.datas" var="supplier" status="s">
<tr>
<td><input type="checkbox" name="IDCheck" value="${supplier.supplierId}" class="acb" /></td>
<td>${supplier.supplierName}</td>
<td>${supplier.abbreviation}</td>
<td>${supplier.legalPerson}</td>
<td>${supplier.address}</td>
<td>${supplier.telephone}</td>
<td>${supplier.credibility}</td>
<td><a href="archiv/supplier_edit?supplierId=${supplier.supplierId}" id="edit">编辑</a>
<a href="javascript:del('${supplier.supplierId}','${pagination.pageIndex}');">删除</a>
<a href="archiv/supplier_detail?supplierId=${supplier.supplierId}" id="detail">详情</a>
</td>
</tr>
</s:iterator>