Package com.arrgsocal.servlets.crud

Source Code of com.arrgsocal.servlets.crud.GetEvent

package com.arrgsocal.servlets.crud;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.arrgsocal.entities.Event;
import com.arrgsocal.managers.EventManager;

/**
* Servlet implementation class GetEvent
*/
@WebServlet("/GetEvent")
public class GetEvent extends HttpServlet {
  private static final long serialVersionUID = 1L;
 
  @EJB
  EventManager eventManager;
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    int id = Integer.parseInt(request.getParameter("id"));
   
    Event e = eventManager.getEvent(id);
    if (e == null){
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Entity not found");
    }
    request.setAttribute("event", e);
    getServletContext().getRequestDispatcher("/WEB-INF/.jsp").forward(request, response);
    return;
  }

}
TOP

Related Classes of com.arrgsocal.servlets.crud.GetEvent

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.