【问题标题】:jsp page dosent load css when using request dispatcher使用requestdispatcher时jsp页面不加载css
【发布时间】:2019-08-18 08:35:56
【问题描述】:
RequestDispatcher requestDispatcher = request.getRequestDispatcher("/answerPage.jsp?id=" + id);
                  requestDispatcher.forward(request, response);

这没用,所以我尝试了这个。

response.sendRedirect("answerpage.jsp");

它只是给了我 404 错误

【问题讨论】:

    标签: java jsp servlets netbeans requestdispatcher


    【解决方案1】:

    如果没有看到您的 answerPage.jsp 的代码,我会确保您在 html 中链接了 css 页面,例如:

    <link rel="stylesheet" type="text/css" href="styles.css">
    

    只需确保 css 文件位于项目的 WEB-INF 文件夹中

    【讨论】:

    • 您可以编辑您的问题以包含 html 和 css 吗?
    • 我包含了我的目录和 css 的图片
    【解决方案2】:

    所以我找到了问题的答案。问题出在我的 xml 文件的 url 映射中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-09
      • 1970-01-01
      相关资源
      最近更新 更多