Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.38 KB | None | 0 0
  1.  
  2. import java.io.IOException;
  3. import java.io.PrintWriter;
  4. import java.sql.Connection;
  5. import java.sql.DriverManager;
  6. import java.sql.PreparedStatement;
  7. import java.sql.ResultSet;
  8. import java.sql.SQLException;
  9. import java.sql.Statement;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import javax.servlet.ServletException;
  13. import javax.servlet.annotation.WebServlet;
  14. import javax.servlet.http.HttpServlet;
  15. import javax.servlet.http.HttpServletRequest;
  16. import javax.servlet.http.HttpServletResponse;
  17. import javax.servlet.http.HttpSession;
  18.  
  19. /**
  20.  *
  21.  * @author Sinus @ qasko
  22.  */
  23. @WebServlet(urlPatterns = {"/main"})
  24. public class main extends HttpServlet {
  25.  
  26.     String driver = "com.mysql.jdbc.Driver";
  27.     Connection con = null;
  28.     Statement stmt = null;
  29.     ResultSet rs = null;
  30.     String userName = "root";
  31.     String password = "";
  32.     String URL = "jdbc:mysql://localhost/obchod";
  33.     HttpSession session;
  34.     Integer id_usera = 0;
  35.  
  36.     @Override
  37.     public void init() {
  38.         try {
  39.             super.init();
  40.             Class.forName(driver);
  41.             con = DriverManager.getConnection(URL, userName, password);
  42.         } catch (ServletException | ClassNotFoundException | SQLException ex) {
  43.         }
  44.     }
  45.  
  46.     public void vypisTovaru(PrintWriter out) {
  47.         int zlava = (Integer) session.getAttribute("zlava");
  48.         double aktCena = 0;
  49.  
  50.         try {
  51.             stmt = con.createStatement();
  52.             rs = stmt.executeQuery("select * from sklad");
  53.             while (rs.next()) {
  54.                 aktCena = rs.getDouble("cena") * (100 - zlava) / 100;
  55.  
  56.                 out.println("<form action='main' method='post'>");
  57.                 out.println("<input type='hidden' name='ID' value='" + rs.getString("ID") + "'>");
  58.                 out.println("<input type='hidden' name='cena' value='" + aktCena + "'>");
  59.                 out.println("<div class='col-md-4'>");
  60.                 out.println("<div class=\"card\">");
  61.                 out.print("<img style='display: inline-block; width: 100%' alt='" + rs.getString("nazov") + "' class=\"card-img-top\" src=\"assets/images/" + rs.getString("ID") + ".jpg\">");
  62.                 out.println("<div class=\"card-block\">");
  63.                 out.println("<h4 class=\"card-title\">" + rs.getString("nazov") + "</h4>");
  64.                 out.println("<h5><small class='text-muted'>" + aktCena + " EUR</small></h5>");
  65.                 if (rs.getInt("ks") <= 0) {
  66.                     out.println("<h6><small class='text-muted'>Nie je skladom.</small></h6>");
  67.                     out.println("<input style='margin-top: 1em' class='btn btn-primary' type='submit' name='tlacidlo' value='Do košíka' disabled>");
  68.                 } else {
  69.                     out.println("<h6><small class='text-muted'>Skladom " + rs.getString("ks") + " ks</small></h6>");
  70.                     out.println("<input style='margin-top: 1em' class='btn btn-primary' type='submit' name='tlacidlo' value='Do košíka'>");
  71.                 }
  72.  
  73.                 out.println("</div></div></div></form>");
  74.             }
  75.             stmt.close();
  76.         } catch (Exception e) {
  77.             out.println("Problém s čítaním " + e.toString());
  78.         }
  79.     }
  80.     //**********************************************************************
  81.  
  82.     public int OverUsera(String meno, String heslo) {
  83.         int vysledok = 0;
  84.         try {
  85.             stmt = con.createStatement();
  86.             rs = stmt.executeQuery("select max(id) as iid,count(id) as pocet from pouzivatelia "
  87.                     + "where login='" + meno + "' and heslo='" + heslo + "'");
  88.  
  89.             rs.next();
  90.             if (rs.getInt("pocet") == 1) {
  91.                 vysledok = rs.getInt("iid");
  92.             }
  93.             stmt.close();
  94.         } catch (Exception ex) {
  95.             return 0;
  96.         }
  97.         return vysledok;
  98.     }
  99. //**********************************************************************
  100.  
  101.     public void ZobrazNeopravnenyPristup(PrintWriter out) {
  102.  
  103.         try {
  104.             out.println("Neoprávnený prístup");
  105.         } catch (Exception ex) {
  106.             out.println(ex.toString());
  107.         }
  108.     }
  109.  
  110.     //**********************************************************************
  111.     public void ZapamatajUdajeOUserovi(int id_usera) {
  112.         // nacitam potrebne udaje z databazy
  113.         try {
  114.             stmt = con.createStatement();
  115.             rs = stmt.executeQuery("select meno, priezvisko, zlava from pouzivatelia "
  116.                     + "where id='" + id_usera + "'");
  117.             rs.next();
  118.             // vlozim data do session
  119.             // session uz bola vytvorena v processRequest
  120.  
  121.             // vlozime ID
  122.             session.setAttribute("ID", (Integer) id_usera);
  123.             // vlozime meno a priezvisko ako jeden celok :)
  124.             session.setAttribute("meno", rs.getString("meno") + " " + rs.getString("priezvisko"));
  125.             // vlozime zlavu ako cislo
  126.             session.setAttribute("zlava", (Integer) rs.getInt("zlava"));
  127.             // nastavim dlzku platnosti session
  128.             session.setMaxInactiveInterval(600); // 10 minut
  129.  
  130.             stmt.close();
  131.         } catch (Exception ex) {
  132.         }
  133.     }
  134.  
  135.     //*******************************************************************************
  136.     public void ZapisDoKosika(Integer id_usera, String id_tovaru, String cena) {
  137.         try {
  138.             stmt = con.createStatement();
  139.             // zistim, ci uz tovar tam je,
  140.             rs = stmt.executeQuery("select count(ID) as pocet from kosik where "
  141.                     + "(ID_pouzivatela='" + id_usera + "') and "
  142.                     + "(id_tovaru ='" + id_tovaru + "')");
  143.             rs.next();
  144.             int pocet = rs.getInt("pocet");
  145.  
  146.             if (pocet == 0) {
  147.                 // ak nie vlozim ho
  148.                 String sstr = "insert into kosik (ID_pouzivatela, id_tovaru, cena, ks) values ("
  149.                         + "'" + id_usera + "', "
  150.                         + "'" + id_tovaru + "', "
  151.                         + "'" + cena + "', "
  152.                         + "'1') ";
  153.                 stmt.executeUpdate(sstr);
  154.             } else {
  155.                 // ak ano, len zvysim pocet ks
  156.                 stmt.executeUpdate("update kosik set ks=ks+1, cena ='" + cena + "' where "
  157.                         + "(ID_pouzivatela='" + id_usera + "') and "
  158.                         + "(id_tovaru ='" + id_tovaru + "')");
  159.             }
  160.             stmt.close();
  161.         } catch (Exception e) {
  162.         }
  163.     }
  164.  
  165.     public void zobrazKosik(PrintWriter out, int zlava) {
  166.         if (con == null) // sem sa dostane vzdy a ak je problem informuje raz
  167.         {
  168.             out.println("Niet spojenia<BR />");
  169.         } else {
  170.  
  171.             try {
  172.                 int count = 0;
  173.                 double cenaTotal = 0;
  174.                 stmt = con.createStatement();
  175.  
  176.                 rs = stmt.executeQuery("select * from kosik inner join sklad ON kosik.ID_tovaru = sklad.ID where (ID_pouzivatela='" + id_usera + "')");
  177.  
  178.                 out.print("<table style='margin-top: 3em' class=\"table\">"
  179.                         + "<thead class=\"thead-default\">"
  180.                         + "<tr>"
  181.                         + "<th>#</th>"
  182.                         + "<th>Nazov</th>"
  183.                         + "<th>Pocet (ks)</th>"
  184.                         + "<th>Cena</th>"
  185.                         + "<th>Akcia</th>"
  186.                         + "</tr>"
  187.                         + "</thead>"
  188.                         + "<tbody>");
  189.  
  190.                 while (rs.next()) {
  191.  
  192.                     count++;
  193.  
  194.                     double aktCena = rs.getDouble("sklad.cena") * (100 - zlava) / 100;
  195.  
  196.                     cenaTotal = (cenaTotal + (aktCena * rs.getDouble("ks")));
  197.  
  198.                     out.println("<tr><th scope=\"row\">" + rs.getString("ID") + "</th><td>" + rs.getString("sklad.nazov") + "</td><td>" + rs.getString("ks") + "</td><td>" + Math.round(aktCena * rs.getDouble("ks") * 100.0) / 100.0 + " EUR</td>"
  199.                             + "<form action='main' method='post'><td><input type='submit' class='btn btn-danger' name='tlacidlo' value='X'>"
  200.                             + "<input type='hidden' name='ID' value='" + rs.getString("ID") + "'>"
  201.                             + "</td></form></tr>");
  202.  
  203.                 }
  204.  
  205.                 out.println("</tbody></table>");
  206.                 out.println("<h5 class='text-muted'>TOTAL: " + Math.round(cenaTotal * 100.00) / 100.00 + " EUR</h5><hr>");
  207.  
  208.                 if (count > 0) { //zobraz objednavacie tlacidlo iba ak je resultset
  209.                     out.println("<form action='main' method='post'>");
  210.                     out.println("<input name='tlacidlo' class='btn btn-primary' type='submit' value='Objednat'>");
  211.                     out.println("</form>");
  212.                 }
  213.  
  214.                 stmt.close();
  215.             } catch (Exception e) {
  216.                 out.println("Problém s čítaním " + e.toString());
  217.             }
  218.         }
  219.     }
  220.  
  221.     /**
  222.      * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
  223.      * methods.
  224.      *
  225.      * @param request servlet request
  226.      * @param response servlet response
  227.      * @throws ServletException if a servlet-specific error occurs
  228.      * @throws IOException if an I/O error occurs
  229.      */
  230.     protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  231.             throws ServletException, IOException {
  232.         response.setContentType("text/html;charset=UTF-8");
  233.         try (PrintWriter out = response.getWriter()) {
  234.             /* TODO output your page here. You may use following sample code. */
  235.             out.println("<!DOCTYPE html>\n"
  236.                     + "<html lang=\"sk\">\n"
  237.                     + "    <head>\n"
  238.                     + "\n"
  239.                     + "        <meta charset=\"utf-8\">\n"
  240.                     + "        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n"
  241.                     + "        <meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\">\n"
  242.                     + "\n"
  243.                     + "        <title>Eshop</title>\n"
  244.                     + "        <link rel=\"stylesheet\" href=\"assets/bootstrap.min.css\">\n"
  245.                     + "\n"
  246.                     + "    </head>\n"
  247.                     + "    <body><div style='margin-top: 1em' class=\"container\">");
  248.  
  249.             // ak uz je user prihlaseny, existuje session
  250.             session = request.getSession();
  251.  
  252.             id_usera = (Integer) session.getAttribute("ID");
  253.  
  254.             if (id_usera == null) {
  255.                 // ak este neexistuje, potrebujeme ju vytvorit po overeni prav
  256.                 // ak to prislo z ineho ako prihlasovacieho formulara,
  257.                 // mohla vyprsat alebo moze ist o neopravneny pristup
  258.                 if (request.getContentType() == null) {
  259.                     response.sendRedirect(request.getContextPath());
  260.                     return;
  261.                 }
  262.  
  263.                 // ak neexistovala session, moze este ist o prvy pristup alebo kosik
  264.                 String tlacidlo = (request.getParameter("tlacidlo")).substring(0, 1);
  265.                 // ak to prislo z prihlasovacieho formulara, prislo to loginom  
  266.                 // zabezpecim overenie prihlasenia
  267.  
  268.                 // bud ide o login - "Vstup"
  269.                 if (tlacidlo.equals("V")) {
  270.                     id_usera = OverUsera(request.getParameter("meno"), request.getParameter("heslo"));
  271.                     if (id_usera == 0) {
  272.                         response.sendRedirect(request.getContextPath() + "/");
  273.                         return;
  274.                     }
  275.                     if (request.getParameter("meno").isEmpty() || request.getParameter("heslo").isEmpty()) {
  276.                         response.sendRedirect(request.getContextPath() + "/");
  277.                         return;
  278.                     }
  279.                     // nova session, potrebujem ju naplnit udajmi
  280.                     // zapamatam si ID aj meno a zlavu, aby sa mi jednoduchsie pracovalo
  281.                     ZapamatajUdajeOUserovi(id_usera);
  282.                 }
  283.  
  284.                 /*
  285.                  * registracia usera
  286.                  *
  287.                  */
  288.                 if (tlacidlo.equals("R")) {
  289.                     String username = request.getParameter("username");
  290.                     String heslo = request.getParameter("heslo");
  291.                     String email = request.getParameter("email");
  292.                     String meno = request.getParameter("meno");
  293.                     String priezvisko = request.getParameter("priezvisko");
  294.                     String adresa = request.getParameter("adresa");
  295.  
  296.                     if (username.isEmpty() || heslo.isEmpty() || email.isEmpty() || meno.isEmpty() || priezvisko.isEmpty() || adresa.isEmpty()) {
  297.                         response.sendRedirect(request.getContextPath() + "/register.html");
  298.                     }
  299.  
  300.                     if (username.length() > 20 || heslo.length() > 20 || email.length() > 40 || adresa.length() > 50 || meno.length() > 20 || priezvisko.length() > 20) {
  301.                         response.sendRedirect(request.getContextPath() + "/register.html");
  302.                     }
  303.  
  304.                     try {
  305.                         stmt = con.createStatement();
  306.                         stmt.executeUpdate("insert into pouzivatelia (login, heslo, mail, adresa, meno, priezvisko, zlava, poznamky) values ("
  307.                                 + "'" + username + "', "
  308.                                 + "'" + heslo + "', "
  309.                                 + "'" + email + "', "
  310.                                 + "'" + adresa + "', "
  311.                                 + "'" + meno + "', "
  312.                                 + "'" + priezvisko + "', "
  313.                                 + "'0', "
  314.                                 + "''"
  315.                                 + ")");
  316.                     } catch (SQLException ex) {
  317.                         Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
  318.                         return;
  319.                     }
  320.  
  321.                     response.sendRedirect(request.getContextPath() + "/");
  322.  
  323.                     return;
  324.                 }
  325.  
  326.             }
  327.  
  328.             // inak je user uz prihlaseny a mam jeho data
  329.             String meno = (String) session.getAttribute("meno");
  330.             out.println("<div class=\"text-xs-right text-muted\">" + meno + "</div>");
  331.  
  332.             int zlava = (Integer) session.getAttribute("zlava");
  333.             out.println("<div class=\"text-xs-right text-muted\">Zlava: " + zlava + "%</div><hr>");
  334.  
  335.             // home btn
  336.             out.println("<div class=\"text-xs-right text-muted\"><a role='button' class='btn btn-info' href='" + request.getContextPath() + "/main'>Home</a>");
  337.  
  338.             // tlacidlo pre zoznam objednavok
  339.             out.println("<form style='display: inline' method='post' action='main'><input type='submit' name='tlacidlo' value='Moj ucet' class='btn btn-warning'></form>");
  340.  
  341.             // tlacidlo pre kosik
  342.             out.println("<form style='display: inline' method='post' action='main'><input type='submit' name='tlacidlo' value='Kosik' class='btn btn-success'></form>");
  343.  
  344.             // odhlasenie
  345.             out.println("<a role='button' class='btn btn-primary' href='logout'>Odhlasenie</a></div>");
  346.  
  347.             // zoznam tovaru s moznostou objednat
  348.             if ((request.getContentType() == null) || (request.getParameter("tlacidlo").substring(0, 1).equals("V")) || (request.getParameter("tlacidlo").substring(0, 1).equals("D"))) {
  349.                 out.println("<div style='margin-top: 3em' class='row'>");
  350.                 vypisTovaru(out);
  351.                 out.println("</div>");
  352.             }
  353.  
  354.             // ak nieje volane naprazdno zostava pridanie tovaru
  355.             if (request.getContentType() != null) {
  356.                 String tlacidlo = (request.getParameter("tlacidlo")).substring(0, 1);
  357.  
  358.                 // alebo o pridanie do kosika - "Do kosika"
  359.                 if (tlacidlo.equals("D")) {
  360.                     ZapisDoKosika(id_usera, request.getParameter("ID"), request.getParameter("cena"));
  361.                 }
  362.  
  363.                 if (tlacidlo.equals("K")) {
  364.                     zobrazKosik(out, zlava);
  365.                 }
  366.  
  367.                 if (tlacidlo.equals("M")) {
  368.                     try {
  369.                         stmt = con.createStatement();
  370.  
  371.                         rs = stmt.executeQuery("select * from pouzivatelia where id =" + id_usera);
  372.  
  373.                         out.print("<div style='margin-top: 3em' class='row'>");
  374.  
  375.                         while (rs.next()) {
  376.                             out.print("<div class='col-md-3'><h5>Meno: </h5><p class='text-muted'>" + rs.getString("meno") + "</p></div>");
  377.                             out.print("<div class='col-md-3'><h5>Priezvisko: </h5><p class='text-muted'>" + rs.getString("priezvisko") + "</p></div>");
  378.                             out.print("<div class='col-md-3'><h5>Username: </h5><p class='text-muted'>" + rs.getString("login") + "</p></div>");
  379.                             out.print("<div class='col-md-3'><h5>Email: </h5><p class='text-muted'>" + rs.getString("mail") + "</p></div>");
  380.                             out.print("<div class='col-md-3'><h5>Adresa: </h5><p class='text-muted'>" + rs.getString("adresa") + "</p></div>");
  381.                             out.print("<div class='col-md-3'><h5>Zlava: </h5><p class='text-muted'>" + rs.getString("zlava") + "%</p></div>");
  382.                         }
  383.  
  384.                         out.println("</div>");
  385.  
  386.                         out.println("<hr><h4>Moje objednavky</h4>");
  387.  
  388.                         rs = stmt.executeQuery("select * from obj_zoznam inner join obj_polozky on obj_polozky.id_objednavky = obj_zoznam.id inner join sklad on sklad.id = obj_polozky.id_tovaru where id_pouzivatela = " + id_usera);
  389.  
  390.                         out.println("<div style='margin-top: 3em' class='row'>");
  391.                         while (rs.next()) {
  392.  
  393.                             out.println("<div class='col-md-6'>");
  394.  
  395.                             out.println("<div class=\"card\"><div class=\"card-header\"><strong>ID:</strong> " + rs.getInt("id") + "</div>"
  396.                                     + "<div class=\"card-block\">"
  397.                                     + "<div class='row'><div class='col-md-4'><strong><p class=\"card-text\">Datum:</strong><br>"
  398.                                     + rs.getString("datum_objednavky") + "</p></div>"
  399.                                     + "<div class='col-md-4'><strong><p class='card-text'>Stav:</strong><br>"
  400.                                     + rs.getString("stav") + "</p></div>"
  401.                                     + "<div class='col-md-4'><strong><p class='card-text'>Suma:</strong><br>"
  402.                                     + rs.getString("suma") + " EUR</p></div></div><hr>"
  403.                                     + "<p class='card-text'><strong>Polozky:</strong></p>"
  404.                                     + "</div>"
  405.                                     + "</div>"
  406.                                     + "");
  407.  
  408.                             out.println("</div>");
  409.                         }
  410.  
  411.                         out.println("</div>");
  412.  
  413.                         stmt.close();
  414.                     } catch (SQLException ex) {
  415.                         Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
  416.                     }
  417.                 }
  418.  
  419.                 if (tlacidlo.equals("X")) {
  420.                     try {
  421.                         stmt = con.createStatement();
  422.  
  423.                         stmt.executeUpdate("DELETE FROM kosik WHERE kosik.id = " + request.getParameter("ID"));
  424.  
  425.                         zobrazKosik(out, zlava);
  426.  
  427.                         stmt.close();
  428.                     } catch (SQLException ex) {
  429.                         Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
  430.                     }
  431.                 }
  432.  
  433.                 if (tlacidlo.equals("O")) {
  434.                     try {
  435.                         double celkovaCena = 0;
  436.  
  437.                         stmt = con.createStatement();
  438.  
  439.                         rs = stmt.executeQuery("select cena, ks from kosik where id_pouzivatela =" + id_usera);
  440.                         while (rs.next()) {
  441.                             celkovaCena = celkovaCena + (rs.getDouble("cena") * rs.getInt("ks"));
  442.                         }
  443.  
  444.                         stmt.executeUpdate("insert into obj_zoznam (datum_objednavky, id_pouzivatela, suma, stav) values ("
  445.                                 + "NOW(), "
  446.                                 + "'" + id_usera + "', "
  447.                                 + "'" + Math.round(celkovaCena * 100.00) / 100.00 + "', "
  448.                                 + "'evidovana'"
  449.                                 + ")", Statement.RETURN_GENERATED_KEYS);
  450.  
  451.                         rs = stmt.getGeneratedKeys();
  452.                         rs.next();
  453.                         int orderID = rs.getInt(1);
  454.  
  455.                         String sql = "insert into obj_polozky (id_objednavky, id_tovaru, cena, ks) VALUES (?, ?, ?, ?)";
  456.                         String sql1 = "update sklad SET ks = ks-? WHERE id = ?";
  457.  
  458.                         PreparedStatement ps = con.prepareStatement(sql);
  459.                         PreparedStatement ps1 = con.prepareStatement(sql1);
  460.  
  461.                         rs = stmt.executeQuery("SELECT * FROM kosik WHERE id_pouzivatela =" + id_usera);
  462.  
  463.                         while (rs.next()) {
  464.  
  465.                             int id_tovaru = rs.getInt("ID_tovaru");
  466.                             double cena = rs.getDouble("cena");
  467.                             int ks = rs.getInt("ks");
  468.  
  469.                             ps.setInt(1, orderID);
  470.                             ps.setInt(2, id_tovaru);
  471.                             ps.setDouble(3, cena);
  472.                             ps.setInt(4, ks);
  473.  
  474.                             ps.executeUpdate();
  475.                             ps.close();
  476.  
  477.                             ps1.setInt(1, ks);
  478.                             ps1.setInt(2, id_tovaru);
  479.  
  480.                             ps1.executeUpdate();
  481.                             ps1.close();
  482.  
  483.                         }
  484.  
  485.                         //vymazene kosik
  486.                         stmt.executeUpdate("delete from kosik where id_pouzivatela = " + id_usera);
  487.  
  488.                         stmt.close();
  489.  
  490.                         out.println("<div style='margin-top: 3em' class='alert alert-success'>Objednavka bola uspesne odoslana.</div>");
  491.                         out.println("<p class='text-muted'>budete presmerovany na domovsku stranku...</p>");
  492.  
  493.                         response.setHeader("Refresh", "2;url=main");
  494.  
  495.                     } catch (SQLException ex) {
  496.                         Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
  497.                     }
  498.                 }
  499.             }
  500.  
  501.             out.println("</div>");
  502.             out.println("        <script src=\"assets/jquery.min.js\"></script>\n"
  503.                     + "        <script src=\"assets/bootstrap.min.js\"></script>");
  504.             out.println("</body>");
  505.             out.println("</html>");
  506.  
  507.         }
  508.     }
  509.  
  510.     // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
  511.     /**
  512.      * Handles the HTTP <code>GET</code> method.
  513.      *
  514.      * @param request servlet request
  515.      * @param response servlet response
  516.      * @throws ServletException if a servlet-specific error occurs
  517.      * @throws IOException if an I/O error occurs
  518.      */
  519.     @Override
  520.     protected void doGet(HttpServletRequest request, HttpServletResponse response)
  521.             throws ServletException, IOException {
  522.         processRequest(request, response);
  523.     }
  524.  
  525.     /**
  526.      * Handles the HTTP <code>POST</code> method.
  527.      *
  528.      * @param request servlet request
  529.      * @param response servlet response
  530.      * @throws ServletException if a servlet-specific error occurs
  531.      * @throws IOException if an I/O error occurs
  532.      */
  533.     @Override
  534.     protected void doPost(HttpServletRequest request, HttpServletResponse response)
  535.             throws ServletException, IOException {
  536.         processRequest(request, response);
  537.     }
  538.  
  539.     /**
  540.      * Returns a short description of the servlet.
  541.      *
  542.      * @return a String containing servlet description
  543.      */
  544.     @Override
  545.     public String getServletInfo() {
  546.         return "Short description";
  547.     }// </editor-fold>
  548.  
  549. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement