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 NewGuest extends SimpleTagSupport {
	public void doTag()
	{
		JspWriter out = getJspContext().getOut();
		try {
			ArrayList a = new DBConn().selectAllGuestBook();
			for(int i = 0; i<5; i++)
			{
				GuestBook gb = (GuestBook)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="+gb.getId()+"' target='_blank'>"+gb.getUsertitle()+"&nbsp;<font color=#cccccc>[by:"+gb.getName()+"]</a></font></div>");
				out.print("</td>");
				out.print("</tr>");
			}
			
				
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}