Hibernate 7
Hibernate 7
Hibernate 7
menu.jsp
<li class="nav-item">
<a class="nav-link" href="update.jsp">Update</a>
</li>
update.jsp
1| Hibernate
<body>
<%@ include file="menu.jsp" %>
<div class="container">
<form role="form" action="update" method="post">
<div class="form-group col-sm-6">
<label>Id</label>
<input type="text" class="form-control" name="id" placeholder="Id">
</div>
<div class="form-group col-sm-6">
<label>Name</label>
<input type="text" class="form-control" name="name" placeholder="Name">
</div>
<div class="form-group col-sm-6">
<label>Email</label>
<input type="email" class="form-control" name="email" placeholder="Email">
</div>
<div class="form-group col-sm-6">
<label>Password</label>
<input type="password" class="form-control" name="password" placeholder="Password">
</div>
<div class="form-group col-sm-6">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>
</div>
</body>
</html>
Update.java
package controller;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import entity.*;
@WebServlet("/update")
public class Update extends HttpServlet {
2| Hibernate
throws ServletException, IOException {
doGet(request, response);
}
try {
updateUser(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UserDAO.java
3| Hibernate