【发布时间】:2011-09-23 16:20:08
【问题描述】:
这是控制器发送给我的内容:
model.addAttribute("weather", weatherService.getWeatherByCity(id));
这是我的 JSP:
<form:form commandName="newWeather" method="post" action="edit">
<c:forEach items="${cities}" var="city">
<form:input path="temperature"></form:input>
<input type="submit" value="Submit">
</c:forEach>
</form:form>
问题:
我从名为weather 的数据库中得到一个对象。我想通过改变温度来编辑它。所以我必须至少发回id 和字段temperature。我知道如何发回如图所示的温度,但我怎样才能发回我的id。
我想我可以从${weather.id} 的模型中得到它,但是我怎样才能将它放在表单中呢?
【问题讨论】:
标签: java forms spring jsp tags