this is what controller sends to me:
model.addAttribute("weather", weatherService.getWeatherByCity(id));
this is my 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>
Problem:
I get one object from database named weather
. I want to edit that by changing temperature. So I must send back atleast id
and field temperature
. I know how to 开发者_开发问答send back temperature as shown, but how can I send back my id
.
I think I can get it from model by ${weather.id}
, but how can I place it in form?
<input type="hidden" name="id" value="${weather.id}">
精彩评论