Assigning value using setProperty

117 Views Asked by At

I have made a JSP page which has <jsp:useBean>. The problem is that, whenever the form is submitted, the value of testName is null in bean and same for 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);
    %>
0

There are 0 best solutions below