我想以弹簧形式使用命令名从jsp文件发送多个对象
我在Google上进行了搜索,并浏览了多个网站,但没有找到解决该问题的方法
<form:form action="addproductLED"method="post"commandname="addProductLed">
<div align="center">
<h2 class="ledtechdetails">Add Led</h2>
</div>
<div style="margin-top:25px;margin-bottom:25px;">
<table border="0" cellpadding="10" cellspacing="10" class="addledtable">
<tr class="add-led">
<td class="add-led">Product Category :</td>
<td class="add-led">
<select id="productCatId"name="productCatId"class="protechname"onchange="showled('led')" required>
</tr>
<tr class="add-led">
<td class="add-led">Product Name :</td>
<td class="add-led">
<input type="text" name="productName" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Stock :</td>
<td class="add-led"><input type="number" name="productStock" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product SKU :</td>
<td class="add-led"><input type="text" name="productsku" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product MRP :</td>
<td class="add-led"><input type="number" name="productMrp" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Price :</td>
<td class="add-led"><input type="number" name="productprize" required class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Product Size :</td>
<td class="add-led"><input type="text" name="productsize" class="protechname"/></td>
</tr>
<!-- another model class configuration -->
<tr class="add-led">
<td class="add-led">Resolution :</td>
<td class="add-led"><input type="text" name="resolution" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Port :</td>
<td class="add-led">
<input type="text" name="port" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Wifi Type :</td>
<td class="add-led"><input type="text" name="type" class="protechname"/></td>
</tr>
<tr class="add-led">
<td class="add-led">Operating System :</td>
<td class="add-led"><input type="text" name="operatingSystem" class="protechname"/></td>
</tr>
我想在Spring Controller中获取模型类对象,但我不知道如何从一个jsp页面发送两个模型类对象
答案 0 :(得分:0)
您可以使用以分号分隔的命令名来传输多个对象,
您必须更改
<form:form action="addproductLED"method="post"commandname="addProductLed">
到
<form:form action="addproductLED" method="post" commandname="addProductLed,anotherObject" enctype="multipart/form-data">
它将发送多个对象。