jsp新代码第410课

new410.jsp

<%@ page import="pack04.new409_NewsServiceImpl" %>
<%@ page import="pack04.new407_NewsDaoImpl" %>
<%@ page import="java.util.List" %>
<%@ page import="pack04.new405_News" %>
<%@ page import="pack04.new406_NewsDao" %>
<%--
Created by IntelliJ IDEA.
User: user1
Date: 2022/6/12
Time: 22:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%
new409_NewsServiceImpl newsService = new new409_NewsServiceImpl();
new406_NewsDao newsDao = new new407_NewsDaoImpl();
newsService.setNewsDao(newsDao);

List<new405_News> newsList = newsService.getNewsList();
int i = 0;
out.print("<table border='1'>");
for(new405_News news:newsList)
{
i++;
out.print("<tr>");
out.print("<td>" + news.getId() +"</td>");
out.print("<td>" + news.getCategroyId() +"</td>");
out.print("<td>" + news.getTitle() +"</td>");
out.print("<td>" + news.getSummary() +"</td>");
out.print("<td>" + news.getContent()+"</td>");
out.print("<td>" + news.getCreatedate() +"</td>");
out.print("</tr>");
}
out.print("</table>");
%>
</body>
</html>