Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @DynamicUpdate
- public class EntityUser
- {
- String login;
- String password;
- public EntityUser() {}
- public EntityUser
- (
- String login,
- String password
- )
- {
- this.login = login;
- this.password = password;
- }
- public String getLogin() {
- return login;
- }
- public void setLogin(String login) {
- this.login = login;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- }
- <form action="#" th:action="@{/loginCheck}" th:object="${user}" method="post">
- <table border="1" width="30%" cellpadding="3">
- <thead>
- <tr>
- <th colspan="2">Login Here</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>User Name</td>
- <td><input type="text" th:field="*{login}"/></td>
- </tr>
- <tr>
- <td>Password</td>
- <td><input type="password" th:field="*{password}"/></td>
- </tr>
- <tr>
- <td><input type="submit" value="Login" /></td>
- <td><input type="reset" value="Reset" /></td>
- </tr>
- </tbody>
- </table>
- </form>
- @RequestMapping(value = "/loginCheck", method = RequestMethod.GET)
- public String userForm(Model model)
- {
- EntityUser user = new EntityUser();
- user.setLogin("login");
- user.setPassword("password");
- model.addAttribute("user", user);
- System.out.println(user.getLogin());
- System.out.println(user.getPassword());
- return "/loginCheck";
- }
- @RequestMapping(value = "/loginCheck", method = RequestMethod.POST)
- public String processUser(@ModelAttribute(value="user") EntityUser user)
- {
- System.out.println(user.getLogin());
- System.out.println(user.getPassword());
- loginInfo = "Jakarta";
- return "redirect:/controllers";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement