Package com.tubeonfire.controller.admin

Source Code of com.tubeonfire.controller.admin.ListTubeServlet

package com.tubeonfire.controller.admin;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tubeonfire.search.admin.TubeSearchModel;

@SuppressWarnings("serial")
public class ListTubeServlet extends HttpServlet {

  private static final Logger log = Logger
      .getLogger(ListTubeServlet.class.getName());

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      int page = 1;
      try {
        page = Integer.parseInt((String) req.getParameter("page"));
      } catch (Exception e) {
        page = 1;
     
     
      String playlistId = req.getParameter("playlistId");
      String channelId = req.getParameter("channelId");
      String keyword = req.getParameter("keyword");     
      TubeSearchModel model = new TubeSearchModel();     
      model.setPage(page);
      model.search(playlistId, channelId, keyword);
     
      req.setAttribute("playlistId", playlistId);
      req.setAttribute("channelId", channelId);
      req.setAttribute("keyword", keyword);
      req.setAttribute("url", req.getRequestURL().toString());
      req.setAttribute("result", model);
      req.getRequestDispatcher("/admin/list_tube.jsp").forward(req,
          resp);
    } catch (Exception e) {
      log.warning(e.toString());
      e.printStackTrace();
      resp.sendError(4004,
          "We are sorry for the inconvenience ! Please try again later !");
    }
  }
}
TOP

Related Classes of com.tubeonfire.controller.admin.ListTubeServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.