<%@page import="bdqn.newsManageServlet.entity.newsTb"%> <%@page import="bdqn.newsManageServlet.Dao.Impl.newsTbDaoImpl"%> <%@page import="bdqn.newsManageServlet.Dao.newsTbDao"%> <%@page import="bdqn.newsManageServlet.entity.categoryTB"%> <%@page import="bdqn.newsManageServlet.Dao.Impl.categoryTBDaoImpl"%> <%@page import="bdqn.newsManageServlet.Dao.categoryTBDao"%> <%@page import="bdqn.newsManageServlet.entity.User"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK" /> <title>新闻中国</title> <link href="CSS/main.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="header"> <% //登录 User user=(User)session.getAttribute("user"); if(user==null){ %> <form action="doLoginServlet" method="post"> <div id="top_login"> <label> 登录名 </label> <input type="text" id="uname" value="" class="login_input" name="uname"/> <label> 密 码 </label> <input type="password" id="upwd" value="" class="login_input" name="upwd" /> <input type="submit" class="login_sub" value="登录" οnclick="login()"/> <label id="error"> </label> <a href="reg.jsp">注册</a> <img src="Images/friend_logo.gif" alt="Google" id="friend_logo" /> </div> </form> <% } else{ out.print("欢迎"+user.getUserName()); } %> <div id="nav"> <div id="logo"> <img src="Images/logo.jpg" alt="新闻中国" /> </div> <div id="a_b01"> <img src="Images/a_b01.gif" alt="" /> </div> <!--mainnav end--> </div> </div> <div id="container"> <div class="sidebar"> <h1> <img src="Images/title_1.gif" alt="国内新闻" /> </h1> <div class="side_list"> <ul> <% //先类别名查询id categoryTBDao cgdao=new categoryTBDaoImpl(); categoryTB cate=cgdao.getCateByName("国内"); int id=cate.getCategoryID(); //根据类别id在新闻表里面查询新闻信息 newsTbDao ndao=new newsTbDaoImpl(); List<newsTb>newlist=ndao.getnewsAllById(id); for(int i=0;i<newlist.size();i++){ newsTb news0=newlist.get(i); %> <li> <a href='newspages/news_read.jsp?newsid=<%=news0.getNewsID() %>'><b><%=news0.getTitle()%></b></a> </li> <% }%> </ul> </div> <h1> <img src="Images/title_2.gif" alt="国际新闻" /> </h1> <div class="side_list"> <ul> <% //先类别名查询id categoryTBDao cgdao1=new categoryTBDaoImpl(); categoryTB cate1=cgdao1.getCateByName("国外"); int id1=cate1.getCategoryID(); //根据类别id在新闻表里面查询新闻信息 newsTbDao ndao1=new newsTbDaoImpl(); List<newsTb>newlist1=ndao1.getnewsAllById(id1); for(int i=0;i<newlist1.size();i++){ %> <li> <a href='newspages/news_read.jsp?newsid=<%=newlist1.get(i).getNewsID() %>'><b><%=newlist1.get(i).getTitle()%> </b></a> </li> <% }%> </ul> </div> <h1> <img src="Images/title_3.gif" alt="娱乐新闻" /> </h1> <div class="side_list"> <ul> <% //先类别名查询id categoryTBDao cgdao2=new categoryTBDaoImpl(); categoryTB cate2=cgdao2.getCateByName("娱乐"); int id2=cate2.getCategoryID(); //根据类别id在新闻表里面查询新闻信息 newsTbDao ndao2=new newsTbDaoImpl(); List<newsTb>newlist2=ndao2.getnewsAllById(id2); for(int i=0;i<newlist2.size();i++){ %> <li> <a href='newspages/news_read.jsp?newsid=<%=newlist2.get(i).getNewsID() %>'><b> <%=newlist2.get(i).getTitle()%></b></a> </li> <%} %> </ul> </div> </div> <div class="main"> <div class="class_type"> <img src="Images/class_type.gif" alt="新闻中心" /> </div> <div class="content"> <ul class="class_date"> <% //获取类别信息 categoryTBDao cdao = new categoryTBDaoImpl(); List<categoryTB> clist = new ArrayList<categoryTB>(); clist = cdao.getCategoryTBAll(); for (int i = 0; i < clist.size(); i++) { %> <li class='class_month'> <a href='#'><b><%=clist.get(i).getCategoryName()%> </b> </a> </li> <% } %> </ul> <ul class="classlist"> <% newsTbDao ndao0=new newsTbDaoImpl(); List<newsTb> nlist=ndao0.getnewsTbAll(); for(int i=0;i<nlist.size();i++){ %> <li><a href='newspages/news_read.jsp?newsid=<%=nlist.get(i).getNewsID()%>'><%=nlist.get(i).getTitle() %></a> <span><%=nlist.get(i).getCreateDate() %></span></li> <%} %> <p align="right"> 当前页数:[1/2] <a href="#">下一页</a> <a href="#">末页</a> </p> </ul> </div> <div class="picnews"> <ul> <li> <a href="#"><img src="Images/Picture1.jpg" width="249" alt="" /> </a><a href="#">幻想中穿越时空</a> </li> <li> <a href="#"><img src="Images/Picture2.jpg" width="249" alt="" /> </a><a href="#">国庆多变的发型</a> </li> <li> <a href="#"><img src="Images/Picture3.jpg" width="249" alt="" /> </a><a href="#">新技术照亮都市</a> </li> <li> <a href="#"><img src="Images/Picture4.jpg" width="249" alt="" /> </a><a href="#">群星闪耀红地毯</a> </li> </ul> </div> </div> </div> <div id="friend"> <h1 class="friend_t"> <img src="Images/friend_ico.gif" alt="合作伙伴" /> </h1> <div class="friend_list"> <ul> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> <li> <a href="#">中国政府网</a> </li> </ul> </div> </div> <div id="footer"> <p class=""> 24小时客户服务热线:010-68988888 <a href="#">常见问题解答</a> 新闻热线:010-627488888 <br /> 文明办网文明上网举报电话:010-627488888 举报邮箱: <a href="#">jubao@jb-aptech.com.cn</a> </p> <p class="copyright"> Copyright © 1999-2009 News China gov, All Right Reserver <br /> 新闻中国 版权所有 </p> </div> </body> </html>