package com.nhaycungbibi.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tubeilike.entity.Category;
import com.tubeilike.entity.CategoryFeed;
import com.tubeilike.model.CategoryModel;
import com.tubeilike.model.TubeModel;
public class HomeController extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
List<Category> listCate = CategoryModel.getTop4();
if (listCate != null && listCate.size() > 0) {
int count = 1;
CategoryFeed cateFeed;
for (Category category : listCate) {
cateFeed = new CategoryFeed();
cateFeed.setAlias(category.getAlias());
cateFeed.setTitle(category.getTitle().getValue());
cateFeed.setListTube(TubeModel.getByCategory(
category.getAlias(), 1, 6));
cateFeed.setCurrentPage(0);
request.setAttribute("top10", TubeModel.getTop10View());
request.setAttribute("title", "NhayCungBiBi - Video clip nhảy cùng bibi.");
request.setAttribute("description", "Chuyên trang clip nhảy cùng bibi.");
request.setAttribute("keyword", "nhảy cùng bibi, nhaycungbibi.com, nhaycungbibi, video clip, youtube, mix clip, tubeonfire.com, tubeonfire, your clip, sharing, camera phone, video phone, free...");
request.setAttribute("categories", CategoryModel.all());
request.setAttribute("result" + count, cateFeed);
count++;
}
request.getRequestDispatcher("home.jsp").forward(request, response);
} else {
response.getWriter().print("Error");
}
}
}