Здравствуйте, при попытке изменить запись выскакивет ошибка :
tomcat - HTTP Status [400] – [Bad Request]
WARN : org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "update"
WARN : org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Handler execution resulted in exception: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "update"
update.jsp:
<form:form action="update" method="post" commandName="word">
<table>
<tr>
<td><form:label path="russWord">Русское Слово
</form:label></td>
<td><form:input path="russWord"/></td>
</tr>
<tr>
<td><form:label path="englishWord">Английское Слово
</form:label></td>
<td><form:input path="englishWord"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Ok"
onclick="/Words/" /></td>
</tr>
</table>
</form:form>
Controller:
@RequestMapping(value = "/update", method = RequestMethod.POST)
public void update(Word word) {
service.updateWord(word);
}
@RequestMapping(value = "/updateWord/{id}")
public String updateWord(@PathVariable("id")int id, Model model) {
Word word = service.getForId(id);
model.addAttribute("word", word);
return "update";
}
Класс Word:
@Entity
@Table(name = "words")
public class Word {
@Id
@Column(name = "WordID")
@GeneratedValue(strategy = GenerationType.AUTO)
private int wordId;
@Column(name = "russWord")
private String russWord;
@Column(name = "englishWord")
private String englishWord;
//getters and setters
}
что я не правильно делаю?