电影列表 - 在线观影平台
影片编号 影片名称 影片时长 影片类型 操作
${f.fid} ${f.fname} ${f.fduration} ${f.ftags} 定票

package servlet;

import model.Film; import service.impl.QueryAllFilmServiceImpl; import util.JdbcUtil;

import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.List;

/**

  • @author 高蒙蒙
  • @date 2023/8/15 12:25 */ @WebServlet("/FilmServlet") public class FilmServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { List filmList=new QueryAllFilmServiceImpl().queryAllFilm(); req.setAttribute("filmList",filmList); req.getRequestDispatcher("/index.jsp").forward(req,resp); } } filmList被正确设置为请求属性。 index.jsp页面接收不到显示名为"filmList"的请求属性 中文解释原因内容:可能的原因是在index.jsp页面中没有正确引入JSTL标签库。在JSP页面的开头,需要使用以下代码引入JSTL标签库:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

如果没有正确引入JSTL标签库,就无法使用<c:forEach>标签来遍历filmList请求属性。请确保在index.jsp页面中正确引入JSTL标签库。

电影列表 - 在线观影平台

原文地址: https://www.cveoy.top/t/topic/qk0d 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录