package beans;

import guestbook.GuestBook;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;


import database.DBConn;

public class News extends SimpleTagSupport {
	public void doTag()
	{
		JspWriter out = getJspContext().getOut();
		try {
			ArrayList a = new DBConn().selectNews();
			//out.print("<table width='99%' border='0'>");
			for(int i = 0; i<9; i++)
			{
				news.News news = (news.News)a.get(i);
				out.print("<tr>");
				out.print("<td>");
				out.print("<div align='left'>"+"<img src='images/dtxwan.gif'/>"+"&nbsp;&nbsp;&nbsp;<a href='shownews.do?id="+news.getId()+"' target='_blank'>"+news.getTitle()+"&nbsp;<font color=#cccccc>[by:"+news.getUsers()+"]</a></font></div>");
				
				out.print("</td>");
				out.print("</tr>");
			}
			//out.print("</table>");
			//out.print("</table>");
				
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}