asked    Cathy     2018-10-22       java       129 view        1 Answer

[SOLVED] why this link works even after logout(or invalidate session)?

I have generated dynamic delete link for each row in a table in jsp. When I click on that link It should delete the associated row,It works Fine. But it should not delete the row once I logged out..I copied the delete link and logged out..Now If I run that link It redirects me to Login page, If I login again viewed the students in a table..It deletes that particular row.

Why this even after removed the attribute and invalidate the session It still able to reach the servlet?

generated link for delete student..

http://localhost:8080/feeManagement/Delete_Action_Student?delete=67657

Here are my DeleteStudent,Logout servlets.

@WebServlet("/Delete_Action_Student")
public class Delete_Action_Student extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public Delete_Action_Student() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        if (request.getAttribute("Accemail") != "") {
            String id = request.getParameter("delete");
            try {
                if (StudentDAOimpl.removeStudent(id)) {
                    request.setAttribute("msg", "deleted successfully");
                    getServletContext().getRequestDispatcher("/Delete_Student").forward(request, response);
                } else {
                    request.setAttribute("msg", "failed to remove");
                    getServletContext().getRequestDispatcher("/Delete_Student").forward(request, response);
                }
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } else {
            response.sendRedirect("/loginjsp.jsp");
        }

    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

    }

}

Logout snippet.

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     HttpSession session = request.getSession();
     session.removeAttribute("Accemail");
     session.invalidate();
     response.sendRedirect("loginjsp.jsp");

    }

  1 Answer  

        answered    Frederica     2018-10-22      

It's the behavior of browser to store the url where you came from to login page. So After successful login it redirect to that url.

After successful login if you want to land always to home page you can do that by using filter.





Your Answer





 2018-10-22         Perry

Two databases with same tables and column names, How to pull out one column with similar data while all the other columns showing the differences?

I have 2 databases named 'OK' and 'TX' with same table named 'E_Model' and columns like: 'Product_ID' , 'Description', 'Warranty' and 'Category'I want to have the list of Product ID's which both the tables have and want to know the difference in all the other column at the same time. Desired result should be like:**'*Database' 'Product_ID' , 'Description', 'Warranty' 'Category'***OK LB9456 COFFEE 436 NULL 10 TX LB9456 TOASTER 956 1 12OK QR3300 APPLE 31 3 15TX ...
 sql-server                     1 answers                     105 view
 2018-10-22         Lambert

Text Split cognitive skill not visible in UI

I am adding Azure Search and trying to add skills for content enrichment.I can see the Key Phrase Extraction and the Language Detection predefined skills but not the Text Split skill on the screen. Is there a reason why Text Split skill is not visible? Or is it something that can only be added via API? The capabilities exposed throught the portal focus on core scenarios that customers want to perform so they do not include text splitting. If you want to split your text, you should do it by creating your own skillset programatically through the API, that will allow you t...
 azure                     1 answers                     110 view
 2018-10-22         Pearl

Questions about mysqldump and Microsoft Azure

I need to dump database which hosts on Microsoft Azure.I tried following: 1. Connect to db with MySQL Workbench. 2. Select Data Export and use it. The warning message says that 'unequal version of mysqldump(8.0.12) and MySQL Server to be dumped(5.7.21) may cause issues' were shown. 3. No upgrades avaliable at MySQL Community Installer. So where's the question:1. How to get mysqldump of required version?2. mysqldump version seems higher than needed but it still doent work. Why?All attemps had following log:18:59:01 Dumping schedule-system (all tables)Running: "C:\Program Fi...
 mysql                     1 answers                     123 view