@Adilmo Yes, we can.
For that, You need to write a servlet that will store the current path of that page using the request parameter.
Once your user logged in to the from login page then redirect to the last path using
request.getRequestDispatcher(lastpPath);