Package Servlet

Source Code of Servlet.ListOfGames

package Servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

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

import beans.GameInfo;

import DAO.JDBCGameDAO;

/**
* Servlet implementation class ListOfGames
*/
public class ListOfGames extends HttpServlet {
  private static final long serialVersionUID = 1L;
      
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ListOfGames() {
        super();
        // TODO Auto-generated constructor stub
    }

  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  JDBCGameDAO game = new JDBCGameDAO();
  if(request.getParameter("game")!=null){
    game.increaseNbOfPlays(request.getParameter("game"));
    GameInfo gameInfo =game.getGameInfo(request.getParameter("game"));
    request.setAttribute("game", gameInfo);
    request.getRequestDispatcher("game.jsp").forward(request, response);
    /*out.println("<embed src='http://localhost:8080/in56/"+gameInfo.getNom()+".swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' height='480' width='720'/>");
    out.println("<br>Description<br>"+gameInfo.getDescription());
    out.println("<br>Controles<br>"+gameInfo.getControls());
    out.println("<br>nombre de fois jouer :"+gameInfo.getNbOfPlays());
    out.println("<br>Rate :"+gameInfo.getRate());*/
   
 
  }/*else{
    ArrayList<String> games=game.getGameUrl();
    out.println("Liste des jeux :<br>");
    for(String nom : games){
      out.println("<br><a href='http://localhost:8080/in56/index.jsp?game="+nom+"'>"+nom+"</a>");
    }
    //out.println("<embed src='http://localhost:8080/in56/themindbender.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' height='720' width='480'></embed>");

  }*/
  }

  /**
   * @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.ListOfGames

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.