What is private static final long serialVersionUID = 1L in the below code?
public class Authenticator extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String username = request.getParameter("username");
String password = request.getParameter("mypassword");
if(authenticate(username, password)) {
HttpSession session = request.getSession();
session.setAttribute("username",username);
response.sendRedirect("product.jsp");
return;
}
else {
response.sendRedirect("index.jsp");
return;
}
}
}
First, few quick pointers regarding this.
MyCustomRuntimeExceptionwhere you don't care about serialization, you could ignore it.From java.io.Serializable
From Joshua Bloch in Effective Java