cssservletshttpresponseresponse.redirectrequestdispatcher

Css can't be loaded when i send data from a servlet


My CSS Stylesheets don't load any JSP page if i send any data to the JSP page the CSS don't load . and when i only use response.sendRedirect( ) without data the CSS can be loaded correctly

List<Specialite> specialite = new ArrayList<>();
Query query = session.createQuery("from Specialite");
specialite = query.list();
t.commit();
request.setAttribute("specialite_list", specialite);
request.getRequestDispatcher("/Jsp/reg_enseignant.jsp").forward(request, response);
response.sendRedirect("//localhost:8086/GestionPfe/Jsp/reg_enseignant.jsp");

If I don't send that ArrayList the CSS appears correclty , any ideas ?


Solution

  • this should works :) finally

       List<Specialite> specialite = new ArrayList<>();
        Query query = session.createQuery("from Specialite");
        specialite = query.list();
        t.commit();
        request.setAttribute("specialite_list", specialite);
        request.getRequestDispatcher("/Jsp/reg_enseignant.jsp").forward(request, response);