我有以下页面(Spring NVC)可以正常工作:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Replace Cards</title>
</head>
<body>
<h3>Replace Cards</h3>
<br/><br/>
Give the numbers of cards in your hand you want replace and hit the button<br/>
Valid numbers: 1 to 5, numbers must be separated by space<br/>
#NEW CODE#
<br/>
<sf:form action="execReplaceCards" commandName="cards">
<table>
<tr>
<td><sf:input path="playerName" type="text"/></td>
<td><sf:input path="numbers" type="text"/></td>
<td><input value="Replace" type="submit"/></td>
</tr>
</table>
</sf:form>
</body>
</html>
直到我在表单标记之前添加以下代码 (上面标记为#NEW CODE#):
Here is your hand:
<br/><br/>
<c:out value="Hand name: "/>
<c:out value="${hand.name}"/><br/>
<c:forEach var="card" items="${hand.cards.card}">
<c:out value="Card:[${card.suit} : ${card.rank}]"/><br/>
</c:forEach>
<c:out value="${hand.value}"/>
<br/>
除了显示玩家手以供参考之外,这个片段不做任何事情,但是因为我添加了这部分,所以我的请求语法错误。请求永远不会到达控制器。怎么了,为什么会这样?