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 ShangWang extends SimpleTagSupport {
	
	public void doTag()
	{
		int aa=0;
		JspWriter out = getJspContext().getOut();
		try {
			ArrayList a = new DBConn().selectNews();
			for(int i = 0; i<a.size(); i++)
			{
				news.News news = (news.News)a.get(i);
				if(news.getClanum()==5)
				{
					out.print("<tr>");
					out.print("<td>");
					out.print("<div align='left'>"+"<img src='images/dtxwan.gif'/>&nbsp;&nbsp;"+"<a href='shownews.do?id="+news.getId()+"' target='_blank'>"+news.getTitle()+"</a></div>");
					out.print("</td>");
					out.print("</tr>");
					aa++;
				}
				if(aa==5)
				{
					break;
				}
				
			}
			
				
			
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
