我制作了一个 JSP 页面,其中包含<jsp:useBean>
. 问题是,每当提交表单时, 的值testName
都null
在 bean 中,对于timLim
.
<form method="POST" action="test-panel.jsp">
<table>
<tr>
<td>
<input style="width:300px" name="testName" type="text" required pattern="[0-9 A-Za-z\\s]*" maxlength="100">
</td>
<tr>
<td>
<input style="width:100px" name="timLim" type="text" pattern="[0-9\\s]*" required maxlength="3">
</td>
<tr>
<td>
<div style="width:100px">
<select name="queRand">
<option value="1">Yes
</option>
<option value="0">No
</option>
</select>
</div>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Next">
</td>
</tr>
</table>
</form>
<jsp:useBean class="pack1.TD1" id="td2" scope="request"></jsp:useBean>
<jsp:setProperty name="td2" property="testName" param="testName"></jsp:setProperty>
<jsp:setProperty name="td2" property="timLim" param="timLim"></jsp:setProperty>
<jsp:setProperty name="td2" property="queRand" param="queRand"></jsp:setProperty>
<%
td2.saveTestDetails(false);
%>