Exemple #1
0
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    HttpSession session = req.getSession();
    String user = req.getParameter("usuario");
    String pass = req.getParameter("contrasena");
    ServletContext app = getServletContext();
    Clientes c = new Clientes();
    Cosas cosas = new Cosas();

    if (!(user != null) || !(pass != null)) {
      req.setAttribute("errorInicio", "<br/>Para acceder a la pagina, debes de logearte");
      session.invalidate();
      app.getRequestDispatcher("/WEB-INF/jsp/inicio.jsp").forward(req, resp);
    } else {
      if (user.equals("") || pass.equals("")) {
        req.setAttribute("errorInicio", "Debes iniciar sesion para acceder");
        app.getRequestDispatcher("/WEB-INF/jsp/inicio.jsp").forward(req, resp);
      } else {
        if (cosas.iniciarSesion(user, pass)) {
          c.setContrasena(pass);
          c.setUsuario(user);
          session.setAttribute("clientes", c);
          app.getRequestDispatcher("/WEB-INF/jsp/principal.jsp").forward(req, resp);
        } else {
          req.setAttribute(
              "errorInicio", "Usuario no registrado, registrate o inicia sesion para acceder");
          app.getRequestDispatcher("/WEB-INF/jsp/inicio.jsp").forward(req, resp);
        }
      }
    }
  }
  public void execute(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(false);

    if (!session.isNew()) {
      String empId = request.getParameter("empId");
      String empIdOld = (String) session.getAttribute("empId");

      if (empIdOld != null && empId.equals(empIdOld)) count += 1;
    }

    EmployeeBean employeeBean = new EmployeeBean();
    mapToEmployeeBean(request, employeeBean);

    if ("success".equalsIgnoreCase(this.checkUser(employeeBean))) {

      String empId = request.getParameter("empId");
      session.setAttribute("empId", empId);
      String fileName =
          "/home/tsuser/Desktop/EmployeeAttendance/WebContent/Store"
              + employeeBean.getEmpId()
              + ".jpg";
      request.setAttribute("fileName", fileName);
      request.setAttribute("employeeBean", employeeBean);
      request.setAttribute("count", count);
      ServletContext context = request.getSession().getServletContext();
      context.getRequestDispatcher("/welcomeUser.jsp").forward(request, response);
    } else {
      ServletContext context = request.getSession().getServletContext();
      context.getRequestDispatcher("/login.jsp").forward(request, response);
    }
  }
Exemple #3
0
  /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
  @SuppressWarnings("unchecked")
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    ServletContext context = getServletContext();
    HttpSession session = request.getSession(true);

    Game game = (Game) session.getAttribute("Pokergame");

    List<Player> players = (List<Player>) session.getAttribute("Pokerplayers");
    ComputerPlayer computerPlayer = (ComputerPlayer) players.get(1);
    Player player1 = players.get(0);
    player1.bet(game);

    int potsizeVoorActie = game.getPotSize();
    computerPlayer.actie(game, true);
    int potsizeNaActie = game.getPotSize();

    // check of AI player raist
    if ((potsizeVoorActie + 10) == potsizeNaActie) {
      request.setAttribute("msg", "AI Player raised 10");
      context.getRequestDispatcher("/Poker/Raise.jsp").forward(request, response);
      return;
    }

    // check of AI player fold
    if (potsizeVoorActie == potsizeNaActie) {
      request.setAttribute("msg", "AI Player folded. You won!");

      Player winner = game.winnerOfHand(players.get(0), players.get(1));
      winner.setStackBijWinstHand(game.getPotSize());
      session.setAttribute("winner", winner);
      request.setAttribute("gain", game.getPotSize());

      context.getRequestDispatcher("/Poker/EndOfGame.jsp").forward(request, response);
      return;
    }

    // als AI player callt, dan het volgende:

    if (game.getTableCards().size() == 0) {
      request.setAttribute("msg", "AI Player called. Flop is dealt. Your turn.");
      game.flop();
    } else if (game.getTableCards().size() == 3) {
      request.setAttribute("msg", "AI Player called. Turn is dealt. Your turn.");
      game.turn();
    } else if (game.getTableCards().size() == 4) {
      request.setAttribute("msg", "AI Player called. River is dealt. Your turn.");
      game.river();
    } else {
      context.getRequestDispatcher("/Poker/End").forward(request, response);
      return;
    }
    context.getRequestDispatcher("/Poker/Game.jsp").forward(request, response);
  }
  /**
   * Delegates to {@link XFireServletController#doService(javax.servlet.http.HttpServletRequest,
   * javax.servlet.http.HttpServletResponse)}.
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");

    String reqURI = request.getRequestURI();
    if (null == user) { // 用户未登录不能查看
      if ("/taxcarship/services/TaxQueryService".equals(reqURI)
          || "/taxcarship/services/TaxQueryService".equals(reqURI)
          || "/taxcarship/services/TaxConfirmService".equals(reqURI)
          || "/taxcarship/services/TaxChangeQueryService".equals(reqURI)
          || "/taxcarship/services/TaxChangeConfirmService".equals(reqURI)
          || "/taxcarship/services/TaxDeclaeredUPloadService".equals(reqURI)
          || "/taxcarship/services/TaxReconciliationService".equals(reqURI)
          || "/taxcarship/services/QuesListUpdateService".equals(reqURI)
          || "/taxcarship/services/TaxPayQueryService".equals(reqURI)) {

        controller.doService(request, response);
      } else {
        ServletContext sc = getServletContext();
        RequestDispatcher requestDispatcher = sc.getRequestDispatcher("/ccs/jsp/wsdlList.jsp");
        requestDispatcher.forward(request, response);
      }
    } else { // 若已登录则可正常显示WSDL列表
      controller.doService(request, response);
    }
  }
Exemple #5
0
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    HttpSession session = request.getSession();
    boolean loggedIn =
        (session.getAttribute("loggedIn") != null && (Boolean) session.getAttribute("loggedIn"));
    List<MnoBill> billList = null;

    if (loggedIn) {
      // Example of Single Logout guarding
      // Check the user session is still valid
      String marketplace = (String) session.getAttribute("marketplace");
      try {
        MnoSession mnoSession = new MnoSession(marketplace, session);
        if (!mnoSession.isValid()) {
          response.sendRedirect(Maestrano.get(marketplace).ssoService().getInitUrl());
          return;
        }
        // Fetch the bills related to the user group
        Map<String, String> filter = new HashMap<String, String>();
        filter.put("groupId", (String) session.getAttribute("groupId"));
        billList = MnoBill.client(marketplace).all(filter);

      } catch (MnoException e) {
        logger.error("Could not retrieve bill", e);
      }
    }

    ServletContext servletContext = getServletContext();
    RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(REDIRECTION_UL);

    request.setAttribute("billList", billList);
    requestDispatcher.forward(request, response);
  }
  @Override
  public void include(ServletContext servletContext, String page) throws Exception {

    RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(page);

    requestDispatcher.include(_request, _response);
  }
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  @Override
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      FAQDTO item = new FAQDTO();
      item.setID(Integer.parseInt(request.getParameter("ID")));
      item.setQuestion((String) request.getParameter("Question"));
      item.setAnswer((String) request.getParameter("Answer"));

      boolean kq = bean.update(item);

      if (kq == true) {
        request.setAttribute("Message", "Update successfully");
      } else {
        request.setAttribute("Message", "Update failed");
      }

      String url = "/views/admin/SelectFAQ.jsp";
      ServletContext sc = getServletContext();
      RequestDispatcher rd = sc.getRequestDispatcher(url);
      rd.forward(request, response);
    } catch (Exception ex) {
      out.println(ex.getMessage());
    } finally {
      out.close();
    }
  }
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");

    message = "";

    // Note: simulation
    user = new User();
    // The logout object performs cleanup
    logout = new Logout(user);

    if (logout.isRemoved()) {
      message = "You are logged out.";
    } else {
      message = "Error logging out.";
    }

    // Verify login
    userid = "cop2806";
    userLoginStatus = new UserLoginStatus(userid);
    if (userLoginStatus.isLoggedIn(userid)) {
      String nextView = "/WEB-INF/jsp/welcome.jsp";
      ServletContext context = getServletContext();
      RequestDispatcher dispatcher = context.getRequestDispatcher(nextView);
      dispatcher.forward(request, response);
    }
  }
Exemple #9
0
  protected void servletAction(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    ServletContext context = getServletContext();
    RequestDispatcher dispatch = context.getRequestDispatcher("/analyst/an_mission4cog.jsp");
    dispatch.forward(request, response);
  }
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  @Override
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      int id = Integer.parseInt(request.getParameter("id"));
      int idfeedback = Integer.parseInt(request.getParameter("idfeedback"));
      boolean kq = replyBean.delete(id);

      if (kq == true) {
        request.setAttribute("Message", "Delete successfully");
      } else {
        request.setAttribute("Message", "Delete failed");
      }

      FeedBacksDTO ds = bean.selectById(idfeedback);
      List<RepliesDTO> lstReplies = replyBean.selectByIDFeedBack(idfeedback);

      request.setAttribute("FeedBacksDTO", ds);
      request.setAttribute("RepliesDTOs", lstReplies);

      String url = "/views/admin/DetailOfFeedback.jsp";
      ServletContext sc = getServletContext();
      RequestDispatcher rd = sc.getRequestDispatcher(url);
      rd.forward(request, response);
    } catch (Exception ex) {
      out.println(ex.getMessage());
    } finally {
      out.close();
    }
  }
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  @Override
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
      CompanyInformationDTO item = new CompanyInformationDTO();
      item.setAddress((String) request.getParameter("Address"));
      item.setPhone((String) request.getParameter("Phone"));
      item.setCompanyDescription((String) request.getParameter("CompanyDescription"));
      item.setServiceDescription((String) request.getParameter("ServiceDescription"));
      item.setBriefCompanyDescription(
          CommonHelpers.Truncate((String) request.getParameter("BriefCompanyDescription"), 300));
      item.setBriefServiceDescription(
          CommonHelpers.Truncate((String) request.getParameter("BriefServiceDescription"), 300));
      item.setPreferExplanation((String) request.getParameter("PreferExplanation"));

      boolean kq = bean.insert(item);

      if (kq == true) {
        request.setAttribute("Message", "Insert successfully");
      } else {
        request.setAttribute("Message", "Insert failed");
      }

      String url = "/views/admin/SelectCompanyInformation.jsp";
      ServletContext sc = getServletContext();
      RequestDispatcher rd = sc.getRequestDispatcher(url);
      rd.forward(request, response);
    } catch (Exception ex) {
      out.println(ex.getMessage());
    } finally {
      out.close();
    }
  }
  private void doForward(String relativeUrlPath) throws ServletException, IOException {

    // JSP.4.5 If the buffer was flushed, throw IllegalStateException
    try {
      out.clear();
    } catch (IOException ex) {
      IllegalStateException ise =
          new IllegalStateException(
              Localizer.getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
      ise.initCause(ex);
      throw ise;
    }

    // Make sure that the response object is not the wrapper for include
    while (response instanceof ServletResponseWrapperInclude) {
      response = ((ServletResponseWrapperInclude) response).getResponse();
    }

    final String path = getAbsolutePathRelativeToContext(relativeUrlPath);
    String includeUri = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);

    if (includeUri != null) request.removeAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
    try {
      context.getRequestDispatcher(path).forward(request, response);
    } finally {
      if (includeUri != null)
        request.setAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH, includeUri);
    }
  }
  /**
   * Handle an HTTP status code or Java exception by forwarding control to the location included in
   * the specified errorPage object. It is assumed that the caller has already recorded any request
   * attributes that are to be forwarded to this page. Return <code>true</code> if we successfully
   * utilized the specified error page location, or <code>false</code> if the default error report
   * should be rendered.
   *
   * @param request The request being processed
   * @param response The response being generated
   * @param errorPage The errorPage directive we are obeying
   */
  private boolean custom(Request request, Response response, ErrorPage errorPage) {

    if (container.getLogger().isDebugEnabled())
      container.getLogger().debug("Processing " + errorPage);

    try {
      // Forward control to the specified location
      ServletContext servletContext = request.getContext().getServletContext();
      RequestDispatcher rd = servletContext.getRequestDispatcher(errorPage.getLocation());

      if (response.isCommitted()) {
        // Response is committed - including the error page is the
        // best we can do
        rd.include(request.getRequest(), response.getResponse());
      } else {
        // Reset the response (keeping the real error code and message)
        response.resetBuffer(true);
        response.setContentLength(-1);

        rd.forward(request.getRequest(), response.getResponse());

        // If we forward, the response is suspended again
        response.setSuspended(false);
      }

      // Indicate that we have successfully processed this custom page
      return (true);

    } catch (Throwable t) {
      ExceptionUtils.handleThrowable(t);
      // Report our failure to process this custom page
      container.getLogger().error("Exception Processing " + errorPage, t);
      return (false);
    }
  }
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    String userName = req.getParameter("name");
    String comment = req.getParameter("comment");

    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

    if (userName != null && comment != null) {
      Entity commentEntity = new Entity("Comment", guestbookKey);
      commentEntity.setProperty("name", userName);
      commentEntity.setProperty("comment", comment);
      datastore.put(commentEntity);
    }

    Query query = new Query("Comment", guestbookKey);
    List<Entity> comments = datastore.prepare(query).asList(FetchOptions.Builder.withDefaults());
    //	  System.out.println();
    req.setAttribute("comments", comments);

    String url = "/guestBook.jsp";
    ServletContext sc = getServletContext();
    RequestDispatcher rd = sc.getRequestDispatcher(url);
    rd.forward(req, resp);
  }
Exemple #15
0
  public void handleRequest(HttpServletRequest request, HttpServletResponse response) {

    String pathInfo = request.getPathInfo();
    System.out.println(" yo les mec" + pathInfo + "");
    switch (pathInfo + "") {
      case "/add":
        System.out.println("addpersonne");
        ajouterPersonne(request);
        break;
      case "/addResponsable":
        System.out.println("addResponsable");
        addResponsable(request);
        break;
      case "/deleteResponsable":
        deleteResponsable(request);
        break;
      case "/deleteInvite":
        deleteInvite(request);
        break;
    }
    AfficherListeInvite(request, response);
    RequestDispatcher rd;
    ServletContext context = this.getServletContext();
    rd = context.getRequestDispatcher(JSP_PATH);
    try {
      rd.forward(request, response);
    } catch (Exception e) {
    }
  }
Exemple #16
0
 /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   // リダイレクト
   ServletContext context = this.getServletContext();
   RequestDispatcher dispatcher = context.getRequestDispatcher("/admin/login.jsp");
   dispatcher.forward(request, response);
 }
  private void addPermission(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    ServletContext context = getServletContext();
    RequestDispatcher dispatcher =
        context.getRequestDispatcher(Utils.permissionToUri(addPermissionName));

    dispatcher.forward(request, response);
  }
  protected RequestDispatcher doGetRequestDispatcher(ServletContext servletContext, String path) {

    if (!PropsValues.DIRECT_SERVLET_CONTEXT_ENABLED) {
      return servletContext.getRequestDispatcher(path);
    }

    if ((path == null) || (path.length() == 0)) {
      return null;
    }

    if (path.charAt(0) != CharPool.SLASH) {
      throw new IllegalArgumentException("Path " + path + " is not relative to context root");
    }

    String contextPath = ContextPathUtil.getContextPath(servletContext);

    String fullPath = contextPath.concat(path);
    String queryString = null;

    int pos = fullPath.indexOf(CharPool.QUESTION);

    if (pos != -1) {
      queryString = fullPath.substring(pos + 1);

      fullPath = fullPath.substring(0, pos);
    }

    Servlet servlet = DirectServletRegistryUtil.getServlet(fullPath);

    if (servlet == null) {
      if (_log.isDebugEnabled()) {
        _log.debug("No servlet found for " + fullPath);
      }

      RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(path);

      return new DirectServletPathRegisterDispatcher(path, requestDispatcher);
    } else {
      if (_log.isDebugEnabled()) {
        _log.debug("Servlet found for " + fullPath);
      }

      return new DirectRequestDispatcher(servlet, queryString);
    }
  }
Exemple #19
0
  private void AnswerRequast(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String Button = request.getParameter("Submit");
    if (Button.equals("Login")) {

      response.setContentType("text/html; charset=utf-8");
      ServletContext sc = getServletContext();
      RequestDispatcher rd = null;
      rd = sc.getRequestDispatcher("/HTML/Login/Login.html");
      rd.forward(request, response);
    } else if (Button.equals("Register")) {
      response.setContentType("text/html; charset=utf-8");
      ServletContext sc = getServletContext();
      RequestDispatcher rd = null;
      rd = sc.getRequestDispatcher("/HTML/Control/AddLogin.html");
      rd.forward(request, response);
    }
  }
 /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   // TODO Auto-generated method stub
   MemberStatisticsDataBean memberStatisticsDataBean =
       adminManageService.getMemberStatisticsDataBean();
   request.setAttribute("memberStatisticsData", memberStatisticsDataBean);
   ServletContext context = getServletContext();
   context.getRequestDispatcher("/jsp/managerShowMemberInfo.jsp").forward(request, response);
 }
 /**
  * ***************************************************************************************************************************
  */
 private void rediriger(
     HttpServletRequest request, HttpServletResponse response, ServletContext sc, String lien) {
   try {
     RequestDispatcher rd = sc.getRequestDispatcher(lien);
     rd.forward(request, response);
   } catch (Exception ex) {
     Logger.getLogger(ServletControle.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    String url = "";
    url = "/pubAction.do?toPage=login"; // 跳转到登录页面
    ServletContext sc = getServletContext();
    RequestDispatcher rd = sc.getRequestDispatcher(url);
    rd.forward(request, response);
  }
  private void handleStudentAssetManager(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    ServletContext servletContext2 = this.getServletContext();
    ServletContext vlewrappercontext = servletContext2.getContext("/vlewrapper");
    User user = ControllerUtil.getSignedInUser();
    String studentuploads_base_dir = portalProperties.getProperty("studentuploads_base_dir");

    try {
      // get the run
      String runId = request.getParameter("runId");
      Run run = runService.retrieveById(new Long(runId));

      // get the project id
      Project project = run.getProject();
      Serializable projectId = project.getId();

      // set the project id into the request so the vlewrapper controller has access to it
      request.setAttribute("projectId", projectId + "");

      // get the workgroup id
      List<Workgroup> workgroupListByOfferingAndUser =
          workgroupService.getWorkgroupListByOfferingAndUser(run, user);
      Workgroup workgroup = workgroupListByOfferingAndUser.get(0);
      Long workgroupId = workgroup.getId();

      // set the workgroup id into the request so the vlewrapper controller has access to it
      request.setAttribute(
          "dirName",
          run.getId()
              + "/"
              + workgroupId
              + "/unreferenced"); // looks like /studentuploads/[runId]/[workgroupId]/unreferenced
      String commandParamter = request.getParameter("command");
      if (commandParamter != null && "studentAssetCopyForReference".equals(commandParamter)) {
        request.setAttribute(
            "referencedDirName",
            run.getId()
                + "/"
                + workgroupId
                + "/referenced"); // if we're copying student asset for reference, also pass along
                                  // the referenced dir. looks like
                                  // /studentuploads/[runId]/[workgroupId]/referenced
      }
      if (studentuploads_base_dir != null) {
        request.setAttribute("studentuploads_base_dir", studentuploads_base_dir);
      }
      // forward the request to the vlewrapper controller
      RequestDispatcher requestDispatcher =
          vlewrappercontext.getRequestDispatcher("/vle/studentassetmanager.html");
      requestDispatcher.forward(request, response);
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (ObjectNotFoundException e) {
      e.printStackTrace();
    }
  }
  private ModelAndView handlePost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String type = request.getParameter("type");
    ServletContext servletContext2 = this.getServletContext();
    ServletContext vlewrappercontext = servletContext2.getContext("/vlewrapper");
    User user = ControllerUtil.getSignedInUser();
    CredentialManager.setRequestCredentials(request, user);

    if (type == null) {
      // post student data
      RequestDispatcher requestDispatcher =
          vlewrappercontext.getRequestDispatcher("/postdata.html");
      requestDispatcher.forward(request, response);
    } else if (type.equals("flag")
        || type.equals("inappropriateFlag")
        || type.equals("annotation")) {
      RequestDispatcher requestDispatcher =
          vlewrappercontext.getRequestDispatcher("/annotations.html");
      requestDispatcher.forward(request, response);
    } else if (type.equals("journal")) {
      RequestDispatcher requestDispatcher =
          vlewrappercontext.getRequestDispatcher("/journaldata.html");
      requestDispatcher.forward(request, response);
    } else if (type.equals("peerreview")) {
      RequestDispatcher requestDispatcher =
          vlewrappercontext.getRequestDispatcher("/peerreview.html");
      requestDispatcher.forward(request, response);
    } else if (type.equals("ideaBasket")) {
      handleIdeaBasket(request, response);
    } else if (type.equals("studentAssetManager")) {
      handleStudentAssetManager(request, response);
    } else if (type.equals("viewStudentAssets")) {
      handleViewStudentAssets(request, response);
    } else if (type.equals("chatLog")) {
      RequestDispatcher requestDispatcher = vlewrappercontext.getRequestDispatcher("/chatLog.html");
      requestDispatcher.forward(request, response);
    } else if (type.equals("studentStatus")) {
      handleStudentStatus(request, response);
    } else if (type.equals("runStatus")) {
      handleRunStatus(request, response);
    }
    return null;
  }
Exemple #25
0
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    ServletContext app = getServletContext();
    HttpSession session = req.getSession();
    Clientes c = (Clientes) session.getAttribute("clientes");
    String cantidadPedido = req.getParameter("cantidadPedido");
    String cantidad = req.getParameter("cantidad");
    String paginaOrigen = req.getParameter("paginaOrigen");
    String nombre = req.getParameter("nombre");
    String precio = req.getParameter("precio");
    String fotos = req.getParameter("fotos");
    String tipo = req.getParameter("tipo");
    String usuario = c.getUsuario();

    if (usuario != null) {
      if (paginaOrigen != null) {
        Cosas.setPedido(nombre, cantidadPedido, usuario, precio, fotos, cantidad, tipo);
        if (paginaOrigen.equals("arboles")) {
          req.setAttribute("arboles", Cosas.getNombreArboles());
          app.getRequestDispatcher("/WEB-INF/jsp/arboles.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("arbustos")) {
          req.setAttribute("arbustos", Cosas.getNombreArbustos());
          app.getRequestDispatcher("/WEB-INF/jsp/arbustos.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("flores")) {
          req.setAttribute("flores", Cosas.getNombreFlores());
          app.getRequestDispatcher("/WEB-INF/jsp/flores.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("mobiliario")) {
          req.setAttribute("mobiliario", Cosas.getNombreMobiliario());
          app.getRequestDispatcher("/WEB-INF/jsp/mobiliario.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("semillas")) {
          req.setAttribute("semillas", Cosas.getNombreSemillas());
          app.getRequestDispatcher("/WEB-INF/jsp/semillas.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("servicios")) {
          req.setAttribute("servicios", Cosas.getNombreServicios());
          app.getRequestDispatcher("/WEB-INF/jsp/servicios.jsp").forward(req, resp);
        }
        if (paginaOrigen.equals("utiles")) {
          req.setAttribute("utiles", Cosas.getNombreUtiles());
          app.getRequestDispatcher("/WEB-INF/jsp/utiles.jsp").forward(req, resp);
        }

      } else {
        req.setAttribute("cesta", Cosas.getPedido(usuario));
        app.getRequestDispatcher("/WEB-INF/jsp/cesta.jsp").forward(req, resp);
      }
    }
  }
  private void requestDispatch(
      ServletContext ctx,
      HttpServletRequest req,
      HttpServletResponse resp,
      String userID,
      String page)
      throws ServletException, IOException {

    ctx.getRequestDispatcher(page).include(req, resp);
  }
Exemple #27
0
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {

    // Get all flights in datastore
    req.setAttribute("flights", Flight.GetFlights());

    // redirect to index.jsp
    ServletContext sc = getServletContext();
    RequestDispatcher rd = sc.getRequestDispatcher("/index.jsp");
    rd.forward(req, resp);
  }
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    ServletContext context = this.getServletContext();
    VehicleTypeAccess dao = new VehicleTypeAccess();

    int id = Integer.parseInt(request.getParameter("id"));
    dao.removeVehicleType(id);

    String forwardAddress = "/ViewVehicleTypes";
    context.getRequestDispatcher(forwardAddress).forward(request, response);
  }
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    req.setAttribute("comments", CommentService.getAllcomments());

    String url = "/admin.jsp";
    ServletContext sc = getServletContext();
    RequestDispatcher rd = sc.getRequestDispatcher(url);
    rd.forward(req, resp);
  }
Exemple #30
0
 static void forwardToJSP(final PwmRequest pwmRequest)
     throws IOException, ServletException, PwmUnrecoverableException {
   final HttpServletRequest req = pwmRequest.getHttpServletRequest();
   final ServletContext servletContext = req.getSession().getServletContext();
   final ConfigGuideBean configGuideBean =
       pwmRequest.getPwmSession().getSessionBean(ConfigGuideBean.class);
   String destURL = '/' + PwmConstants.URL_JSP_CONFIG_GUIDE;
   destURL = destURL.replace("%1%", configGuideBean.getStep().toString().toLowerCase());
   servletContext
       .getRequestDispatcher(destURL)
       .forward(req, pwmRequest.getPwmResponse().getHttpServletResponse());
 }