从servlet发送数据时无法加载Css

时间:2018-04-28 23:04:47

标签: css servlets httpresponse response.redirect requestdispatcher

我的CSS样式表不会加载任何JSP页面 如果我将任何数据发送到JSP页面,则CSS不会加载。 当我只使用没有数据的response.sendRedirect()时,可以正确加载CSS

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");

如果我不发送那个ArrayList,则CSS显示为correclty, 任何想法?

1 个答案:

答案 0 :(得分:0)

这应该有效:)终于

   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);