JSP页面实现获取后台list数组

在做课设的过程中,遇到了需要在前端页面上接收显示后端传过来的list数组的问题,下面的代码是判断数据库中是否有新闻显示的例子:
在JSP页面上导入函数标签库:
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core”%>
<%@ taglib prefix=“fn” uri=“http://java.sun.com/jsp/jstl/functions”%>

中代码如下: <% ArrayList nn=NewsDAO.retrieveAll(); if(nn==null||nn.size()==0){ out.print("目前没有新闻可显示!"); } else{ for(int i=nn.size()-1;i>=0;i--){ News news=(News)nn.get(i); %>

猜你喜欢

转载自blog.csdn.net/weixin_53233197/article/details/111971922