Package Servlet

Source Code of Servlet.OnStartUp

package Servlet;

import java.io.IOException;

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

import beans.Faq;
import beans.GameInfo;
import beans.ListOfGames;
import beans.QuestionReponse;
import beans.SiteInfo;

import DAO.JDBCGameDAO;
import DAO.JDBCSiteDAO;
import DAO.JDBCTableDAO;
import Interface.GameDAOInterface;
import Interface.SiteDAOInterface;

/**
* Servlet implementation class OnStartUp
*/
public class OnStartUp extends HttpServlet {
  private static final long serialVersionUID = 1L;
      
    @Override
  public void init(ServletConfig config) throws ServletException {
    // TODO Auto-generated method stub
    super.init(config);
    // set application scope parameter
  
      SiteDAOInterface site= new JDBCSiteDAO();
        System.out.println("Loading data");
        site.loadSiteInfo();
        System.out.println("Site info loaded:"+SiteInfo.getTitre() +" "+SiteInfo.getDescription());
        site.loadListOfGames();
        for(GameInfo game : ListOfGames.getListOfGames()){
          System.out.println(game.getNom());
        }
        site.loadFAQ();
       
        // to "Certification by Que"
      ServletContext context = config.getServletContext();
      context.setAttribute("faq",Faq.getFaq());

      context.setAttribute("listOfGames", ListOfGames.getListOfGames());
      context.setAttribute("siteTitre", SiteInfo.getTitre());
      context.setAttribute("siteDescription", SiteInfo.getDescription());
      GameDAOInterface game = new JDBCGameDAO();
      context.setAttribute("gameOfTheMonth", game.getGameOfTheMonth());
     
      JDBCTableDAO table = new JDBCTableDAO();
    table.loadTables();
    table.loadDatas();
    context.setAttribute("listOfTables", beans.ListOfTables.getListOfTables());
    //context.setAttribute(arg0, arg1)
  }

  /**
     * @see HttpServlet#HttpServlet()
     */
    public OnStartUp() {
        super();
        //chargement des information dynamique du site web
      
        // TODO Auto-generated constructor stub
    }

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
   
  }

  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
  }

}
TOP

Related Classes of Servlet.OnStartUp

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.