Я новичок в тимилфиле и весне, и я пытаюсь отправить простые входные данные со страницы индекса на контроллер, поэтому я создал объект Exchange, показанный ниже, где он будет содержать поля входных данных для обработки. Проблема в том, что я получаю сообщение об ошибке, показанное на картинке
, вот мой объект Exchange
package myprivate.work.MyCurrencyConverter.model;
public class Exchange
{
private String fromcurrency;
private String tocurrency;
private double amount;
public Exchange(){
super();
}
public Exchange(String fromcurrency, String tocurrency, double amount) {
super();
this.fromcurrency = fromcurrency;
this.tocurrency = tocurrency;
this.amount = amount;
}
public String getFromcurrency() {
return fromcurrency;
}
public void setFromcurrency(String fromcurrency) {
this.fromcurrency = fromcurrency;
}
public String getTocurrency() {
return tocurrency;
}
public void setTocurrency(String tocurrency) {
this.tocurrency = tocurrency;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
}
, и это форма, которую я имею в индексе
<form th:action="@{/newexchange}" th:object="${exchange}" method='POST'>
<p>Select From Currency:</p>
<p>
<select th:field="*{fromcurrency}"> <!-- this is line 12 -->
<option th:value="sek">SEK</option>
<option th:value="eur">EUR</option>
<option th:value="usd">USD</option>
<option th:value="jpy">JPY</option>
</select>
</p>
<p>Select To Currency:</p>
<p>
<select th:field="*{tocurrency}">
<option th:value="sek">SEK</option>
<option th:value="eur">EUR</option>
<option th:value="usd">USD</option>
<option th:value="jpy">JPY</option>
</select>
</p>
<p class="form"><label>Insert New Rate:</label><input type="number" th:field="*{amount}"/>
</p>
<p><input name="Convert" type="submit" value="submit"/></p>
</form>
и в моем контроллере
@RequestMapping(method = RequestMethod.POST , value = "/newexchange")
public String toExchange(Exchange exchange, BindingResult result)
{
return "..ok..";
}
вот