www.pudn.com > Jsp-Blog.rar > ShowFavoriteLogServlet.java, change:2010-05-28,size:1094b


package myblog.servlet; 
 
import java.io.IOException; 
import java.util.ArrayList; 
 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import myblog.dao.ShowFavoriteLogsDao; 
import myblog.entity.Logs; 
 
public class ShowFavoriteLogServlet  extends HttpServlet{ 
	 
	public void doPost(HttpServletRequest request, HttpServletResponse response) { 
		String username = request.getSession().getAttribute("username") 
		.toString(); 
		if(username==null){ 
			username="xiaoqiang"; 
		} 
	ShowFavoriteLogsDao fav=new ShowFavoriteLogsDao(); 
	ArrayList<Logs> list=fav.showFavoriteLog(username); 
	request.setAttribute("favlist", list); 
	try { 
		request.getRequestDispatcher("favourite.jsp").forward(request, response); 
	} catch (ServletException e) { 
		e.printStackTrace(); 
	} catch (IOException e) { 
		e.printStackTrace(); 
	} 
	} 
	 
	 
	 
 
		public void doGet(HttpServletRequest request, HttpServletResponse response) { 
			doPost(request,response); 
		} 
}