Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver handleTypeMismatch
  2. WARNING: Failed to bind request element: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "updateStudent"
  3.  
  4. <form:form method="GET" action="updateStudent" commandName="selectedUser">
  5. <table>
  6.  
  7. <tr>
  8. <form:input path="userID" placeholder="userID"
  9. value="${selectedUsers.userID}" />
  10. <form:input path="userName" placeholder="userName"
  11. value="${selectedUsers.userName}" />
  12. <form:input path="password" placeholder="password"
  13. value="${selectedUsers.password}" />
  14. </tr>
  15. <tr>
  16. <td colspan="2"><input type="submit" value="Submit" /></td>
  17. </tr>
  18. </table>
  19. </form:form>
  20.  
  21. @RequestMapping(value = "updateStudent", method = RequestMethod.GET)
  22.  
  23. public String updateStudent(@ModelAttribute("selectedUser") User user,
  24. ModelMap model) throws Exception {
  25.  
  26. Student student = new Student();
  27. System.out.println("come here helloController()");
  28. model.addAttribute("userID", user.getUserID());
  29. model.addAttribute("userName", user.getUserName());
  30. model.addAttribute("password", user.getPassword());
  31. model.addAttribute("student",student);
  32. model.addAttribute("user",user);
  33. System.out.println("student id is " + user.getUserID());
  34. // model.addAttribute("userI", user);
  35. if (user.getUserID() == 0) {
  36. model.addAttribute("error", "please enter id");
  37. return "home";
  38. }
  39. if (user.getUserName() == null) {
  40. model.addAttribute("error", "please enter getUserName");
  41. return "home";
  42. }
  43. if (user.getPassword() == null) {
  44. model.addAttribute("error", "please enter getPassword");
  45. return "home";
  46. }
  47. return "home";
  48. }
  49.  
  50. public class User {
  51. int userID;
  52. String userName;
  53. String password;
  54.  
  55. public int getUserID() {
  56. return userID;
  57. }
  58.  
  59. public void setUserID(int userID) {
  60. this.userID = userID;
  61. }
  62.  
  63. public String getUserName() {
  64. return userName;
  65. }
  66.  
  67. public void setUserName(String userName) {
  68. this.userName = userName;
  69. }
  70.  
  71. public String getPassword() {
  72. return password;
  73. }
  74.  
  75. public void setPassword(String password) {
  76. this.password = password;
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement