When a form form written today is submitted, it always reports an error and no mapping can be found. The form is as follows:
1 <form action="toUpdate.do" method="post"> 2 id:<input type="text" name="id" value="${list.id }" readonly="readonly"><br> 3 name:<input type="text" name="name" value="${list.name }"><br> 4 sex:male:<input type="radio" name="sex" value="1" ${list.sex==1?"checked='checked'":"" }> 5 female:<input type="radio" name="sex" value="0" ${list.sex==0?"checked='checked'":"" }><br> 6 birthday:<input type="text" name="birthday" value="${list.birthday }"><br> 7 phone:<input type="text" name="phone" value="${list.phone }"><br> 8 <input type="submit" value="ok"> 9 </form>
The check found that there was an extra part in the address bar at each submission:
This is because an id is inserted into the address when you jump to the page because of the @ PathVariable annotation
1 <a href="toAddPage.do">Add to</a> 2 <table border="1"> 3 <tr> 4 <td>id</td> 5 <td>name</td> 6 <td>sex</td> 7 <td>birthday</td> 8 <td>phone</td> 9 <td colspan="2">operation</td> 10 </tr> 11 <c:forEach items="${list }" var="l"> 12 <tr> 13 <td>${l.id }</td> 14 <td>${l.name }</td> 15 <td>${l.sex==1?"male":"female" }</td> 16 <td> 17 <f:formatDate value="${l.birthday }" pattern="yyyy year MM month dd day"/> 18 </td> 19 <td>${l.phone }</td> 20 <td><a href="${l.id }/toDelete.do">delete</a></td> 21 <td><a href="${l.id }/toUpdatePage.do">modify</a></td> //You can see that there is an id in the hyperlink address of the a tag 22 </tr> 23 </c:forEach> 24 </table>
This leads to a part of the url after the page Jump is executed. At this time, when filling in the action like the form form above, the address column information will not match, and 500 errors will appear
At this time, the action of the form form should add the project path, as follows:
1 <form action="/t0402/toUpdate.do" method="post"> 2 id:<input type="text" name="id" value="${list.id }" readonly="readonly"><br> 3 name:<input type="text" name="name" value="${list.name }"><br> 4 sex:male:<input type="radio" name="sex" value="1" ${list.sex==1?"checked='checked'":"" }> 5 female:<input type="radio" name="sex" value="0" ${list.sex==0?"checked='checked'":"" }><br> 6 birthday:<input type="text" name="birthday" value="${list.birthday }"><br> 7 phone:<input type="text" name="phone" value="${list.phone }"><br> 8 <input type="submit" value="ok"> 9 </form>
So there's no more misstatement