Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Created by leon on 8/31/2020.
*/
@Controller
@RequestMapping("/index-controller")
@RequestMapping("/")
@SessionAttributes("userKey")
public class IndexController {

Expand All @@ -34,8 +34,8 @@ public ModelAndView userInfo(
return mav;
}

@RequestMapping(value = "/userInfoConfirm", method = RequestMethod.POST)
public ModelAndView userInfoConfirm(@RequestAttribute("userKey") User user) {
@PostMapping(value = "/userInfo_confirm")
public ModelAndView userInfoConfirm(@ModelAttribute("userKey") User u) {
return new ModelAndView("user-account-page");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
/**
* Created by leon on 8/31/2020.
*/
@Entity

public class User {
@Id
private String username;
private String password;
private String email;
Expand Down Expand Up @@ -36,4 +35,6 @@ public String getEmail() {
public void setEmail(String email) {
this.email = email;
}


}
5 changes: 5 additions & 0 deletions java/2020Aug31/lecture2/src/main/webapp/WEB-INF/jsp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<input type="text" id="user" name="username" />
</div>

<div class="sub_field">
<label>Password</label>
<input type="password" id="pass" name="password" />
</div>

<div class="sub_field">
<label>Email</label>
<input type="text" id="email" name="email" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% User u = (User)session.getAttribute("userKey"); %>
<%@ page import="com.github.perscholas.User" %><% User u = (User)session.getAttribute("userKey"); %>
<h1>Change User Information</h1>
<div class="container">
<form action="submit-changes" method="POST">
<div class="sub_field">
<label>User Name</label>
<input type="text" id="user" name="username"
value=<%=u.getPassword()%> />
value=<%=u.getUsername()%> />
</div>
<div>
<label>Password</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<% User u = (User)session.getAttribute("userKey"); %>
<%@ page import="com.github.perscholas.User" %><% User u = (User)session.getAttribute("userKey"); %>

<div class="user_table">
<table>
<tr>
<td>User Name</td>
<td><%=u.getUsername()></td>
<td><%= u.getUsername() %></td>
</tr>
<tr>
<td>Password</td>
<td><%=u.getUserPassword()></td>
<td><%= u.getPassword() %></td>
</tr>
<tr>
<td>Email</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<h1>Confirm your Info</h1>
<div class="conteiner">
<div class="container">
<form action="userInfo_confirm" method="POST">
<div class="sub_field">
<label>User Name</label>
<input type="text" id="user" name = "username" value=${username} />
<label for="user"></label><input type="text" id="user" name = "username" value=${username} />
<div>
<div class="sub_field">
<label>Password</label>
<input type="text" id="password" name = "password" value=${password} />
<label for="pass"></label><input type="text" id="pass" name = "password" value=${password} />
<div>
<div class="sub_field">
<label>Email</label>
<input type="text" id="email" name = "email" value=${email} />
<label for="email"></label><input type="text" id="email" name = "email" value=${email} />
<div>
<div class="btn">
<input type="submit" name="submit" value="Submit Info" />
Expand Down