silinium 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. silinium-0.1.0/PKG-INFO +15 -0
  2. silinium-0.1.0/README.md +8 -0
  3. silinium-0.1.0/pyproject.toml +16 -0
  4. silinium-0.1.0/setup.cfg +4 -0
  5. silinium-0.1.0/silinium/__init__.py +1 -0
  6. silinium-0.1.0/silinium/__main__.py +53 -0
  7. silinium-0.1.0/silinium/practicals/a/prac1.html +20 -0
  8. silinium-0.1.0/silinium/practicals/a/prac1.java +89 -0
  9. silinium-0.1.0/silinium/practicals/b/prac2.html +21 -0
  10. silinium-0.1.0/silinium/practicals/b/prac2.java +105 -0
  11. silinium-0.1.0/silinium/practicals/c/prac3.html +19 -0
  12. silinium-0.1.0/silinium/practicals/c/prac3.java +101 -0
  13. silinium-0.1.0/silinium/practicals/d/prac4.html +15 -0
  14. silinium-0.1.0/silinium/practicals/d/prac4.java +88 -0
  15. silinium-0.1.0/silinium/practicals/e/prac5.html +20 -0
  16. silinium-0.1.0/silinium/practicals/e/prac5.java +88 -0
  17. silinium-0.1.0/silinium/practicals/f/prac6.html +21 -0
  18. silinium-0.1.0/silinium/practicals/f/prac6.jsp +53 -0
  19. silinium-0.1.0/silinium/practicals/g/prac7.html +20 -0
  20. silinium-0.1.0/silinium/practicals/g/prac7.jsp +97 -0
  21. silinium-0.1.0/silinium/practicals/h/prac8.html +17 -0
  22. silinium-0.1.0/silinium/practicals/h/prac8fu.java +108 -0
  23. silinium-0.1.0/silinium/practicals/i/prac9.html +20 -0
  24. silinium-0.1.0/silinium/practicals/i/prac9.java +79 -0
  25. silinium-0.1.0/silinium/practicals/j/prac10.jsp +71 -0
  26. silinium-0.1.0/silinium/practicals/k/currencybean11.java +28 -0
  27. silinium-0.1.0/silinium/practicals/k/prac11.html +26 -0
  28. silinium-0.1.0/silinium/practicals/k/prac11.java +82 -0
  29. silinium-0.1.0/silinium/practicals/l/prac12.html +18 -0
  30. silinium-0.1.0/silinium/practicals/l/prac12.java +21 -0
  31. silinium-0.1.0/silinium/practicals/l/prac122.java +76 -0
  32. silinium-0.1.0/silinium/practicals/m/p6.py +12 -0
  33. silinium-0.1.0/silinium/practicals/m/st.py +21 -0
  34. silinium-0.1.0/silinium.egg-info/PKG-INFO +15 -0
  35. silinium-0.1.0/silinium.egg-info/SOURCES.txt +35 -0
  36. silinium-0.1.0/silinium.egg-info/dependency_links.txt +1 -0
  37. silinium-0.1.0/silinium.egg-info/top_level.txt +1 -0
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: silinium
3
+ Version: 0.1.0
4
+ Summary: Practical source code installer
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # Silinium
9
+
10
+ Silinium is a Python CLI package for adding practical source files to a project.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ py -m pip install silinium
@@ -0,0 +1,8 @@
1
+ # Silinium
2
+
3
+ Silinium is a Python CLI package for adding practical source files to a project.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ py -m pip install silinium
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "silinium"
7
+ version = "0.1.0"
8
+ description = "Practical source code installer"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+
12
+ [tool.setuptools]
13
+ include-package-data = true
14
+
15
+ [tool.setuptools.package-data]
16
+ silinium = ["practicals/**/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,53 @@
1
+ import argparse
2
+ import shutil
3
+ from pathlib import Path
4
+ from importlib.resources import files
5
+
6
+
7
+ def add_practical(letter, project_path):
8
+
9
+ letter = letter.lower()
10
+
11
+ if not letter.isalpha() or len(letter) != 1:
12
+ return
13
+
14
+ project = Path(project_path)
15
+
16
+ if not project.exists() or not project.is_dir():
17
+ return
18
+
19
+ source_dir = files("silinium") / "practicals" / letter
20
+
21
+ if not source_dir.is_dir():
22
+ return
23
+
24
+ for source in source_dir.iterdir():
25
+
26
+ if not source.is_file():
27
+ continue
28
+
29
+ destination = project / source.name
30
+
31
+ if destination.exists():
32
+ continue
33
+
34
+ with source.open("rb") as src:
35
+ with open(destination, "wb") as dst:
36
+ shutil.copyfileobj(src, dst)
37
+
38
+
39
+ def main():
40
+
41
+ parser = argparse.ArgumentParser(add_help=False)
42
+
43
+ parser.add_argument("practical")
44
+ parser.add_argument("--path")
45
+
46
+ args = parser.parse_args()
47
+
48
+ if args.path:
49
+ add_practical(args.practical, args.path)
50
+
51
+
52
+ if __name__ == "__main__":
53
+ main()
@@ -0,0 +1,20 @@
1
+
2
+ <html>
3
+ <head>
4
+ <title>Practial1</title>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ </head>
8
+ <body>
9
+ <form action ="prac1" method="POST">
10
+ <label>Name: </label>
11
+ <input type="text" id="username" name="uname">
12
+ <br>
13
+ <label> password :</label>
14
+ <input type="password" id="password" name="pass">
15
+ <<br>
16
+ <input type="submit">
17
+
18
+ </form>
19
+ </body>
20
+ </html>
@@ -0,0 +1,89 @@
1
+ /*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+ package demo;
7
+
8
+ import java.io.IOException;
9
+ import java.io.PrintWriter;
10
+ import static java.lang.System.out;
11
+ import javax.servlet.ServletException;
12
+ import javax.servlet.annotation.WebServlet;
13
+ import javax.servlet.http.HttpServlet;
14
+ import javax.servlet.http.HttpServletRequest;
15
+ import javax.servlet.http.HttpServletResponse;
16
+
17
+ @WebServlet(name = "prac1", urlPatterns = {"/prac1"})
18
+ public class prac1 extends HttpServlet {
19
+
20
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
21
+ throws ServletException, IOException {
22
+ response.setContentType("text/html;charset=UTF-8");
23
+ String n=request.getParameter("uname");
24
+ String p=request.getParameter("pass");
25
+
26
+ try (PrintWriter out = response.getWriter()) {
27
+ /* TODO output your page here. You may use following sample code. */
28
+ out.println("<!DOCTYPE html>");
29
+ out.println("<html>");
30
+ out.println("<head>");
31
+ out.println("<title>Servlet prac1</title>");
32
+ out.println("</head>");
33
+ out.println("<body>");
34
+ if("user".equals(n) && "user123".equals(p)){
35
+ out.println("Welcome");
36
+ out.println(n);
37
+ }
38
+ else{
39
+ out.println("Invalid credential");
40
+ }
41
+
42
+ out.println("</body>");
43
+ out.println("</html>");
44
+ }
45
+ catch(Exception e){
46
+ out.println("eror");
47
+ }
48
+ }
49
+
50
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
51
+ /**
52
+ * Handles the HTTP <code>GET</code> method.
53
+ *
54
+ * @param request servlet request
55
+ * @param response servlet response
56
+ * @throws ServletException if a servlet-specific error occurs
57
+ * @throws IOException if an I/O error occurs
58
+ */
59
+ @Override
60
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
61
+ throws ServletException, IOException {
62
+ processRequest(request, response);
63
+ }
64
+
65
+ /**
66
+ * Handles the HTTP <code>POST</code> method.
67
+ *
68
+ * @param request servlet request
69
+ * @param response servlet response
70
+ * @throws ServletException if a servlet-specific error occurs
71
+ * @throws IOException if an I/O error occurs
72
+ */
73
+ @Override
74
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
75
+ throws ServletException, IOException {
76
+ processRequest(request, response);
77
+ }
78
+
79
+ /**
80
+ * Returns a short description of the servlet.
81
+ *
82
+ * @return a String containing servlet description
83
+ */
84
+ @Override
85
+ public String getServletInfo() {
86
+ return "Short description";
87
+ }// </editor-fold>
88
+
89
+ }
@@ -0,0 +1,21 @@
1
+
2
+ <html>
3
+ <head>
4
+ <title>Practial 2</title>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ </head>
8
+ <body>
9
+ <div>dynamic login</div>
10
+ <form action ="prac2" method="POST">
11
+ <label>Name: </label>
12
+ <input type="text" id="username" name="uname">
13
+ <br>
14
+ <label> password :</label>
15
+ <input type="password" id="password" name="pass">
16
+ <<br>
17
+ <input type="submit">
18
+
19
+ </form>
20
+ </body>
21
+ </html>
@@ -0,0 +1,105 @@
1
+ /*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+ package demo;
7
+
8
+ import java.io.IOException;
9
+ import java.io.PrintWriter;
10
+ import static java.lang.System.out;
11
+ import java.sql.Connection;
12
+ import java.sql.DriverManager;
13
+ import java.sql.ResultSet;
14
+ import java.sql.Statement;
15
+ import javax.servlet.ServletException;
16
+ import javax.servlet.annotation.WebServlet;
17
+ import javax.servlet.http.HttpServlet;
18
+ import javax.servlet.http.HttpServletRequest;
19
+ import javax.servlet.http.HttpServletResponse;
20
+
21
+
22
+ @WebServlet(name = "prac2", urlPatterns = {"/prac2"})
23
+ public class prac2 extends HttpServlet {
24
+
25
+
26
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
27
+ throws ServletException, IOException {
28
+ response.setContentType("text/html;charset=UTF-8");
29
+ String n=request.getParameter("uname");
30
+ String p=request.getParameter("pass");
31
+ String url = "jdbc:mysql://localhost:3306/ej_practical?useSSL=false";
32
+ String root = "root";
33
+ String pass = "";
34
+ String q = "select * from login where uname='"+n+"' AND pass='"+p+"'";
35
+
36
+ try (PrintWriter out = response.getWriter()) {
37
+
38
+
39
+ Class.forName("com.mysql.cj.jdbc.Driver");
40
+ Connection c = DriverManager.getConnection(url, root, pass);
41
+ Statement st=c.createStatement();
42
+ ResultSet rs=st.executeQuery(q);
43
+ /* TODO output your page here. You may use following sample code. */
44
+ out.println("<!DOCTYPE html>");
45
+ out.println("<html>");
46
+ out.println("<head>");
47
+ out.println("<title>Servlet prac2</title>");
48
+ out.println("</head>");
49
+ out.println("<body>");
50
+ if(rs.next()){
51
+ out.println("Login successful");
52
+ out.println("<h>Welcome "+n+"</h>");
53
+ }
54
+ else{
55
+ out.println("Invaild credential's");
56
+ }
57
+ out.println("</body>");
58
+ out.println("</html>");
59
+ c.close();
60
+ }
61
+ catch(Exception e){
62
+ out.println("<h1Error " + e.getMessage() + "</h1>");
63
+ }
64
+ }
65
+
66
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
67
+ /**
68
+ * Handles the HTTP <code>GET</code> method.
69
+ *
70
+ * @param request servlet request
71
+ * @param response servlet response
72
+ * @throws ServletException if a servlet-specific error occurs
73
+ * @throws IOException if an I/O error occurs
74
+ */
75
+ @Override
76
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
77
+ throws ServletException, IOException {
78
+ processRequest(request, response);
79
+ }
80
+
81
+ /**
82
+ * Handles the HTTP <code>POST</code> method.
83
+ *
84
+ * @param request servlet request
85
+ * @param response servlet response
86
+ * @throws ServletException if a servlet-specific error occurs
87
+ * @throws IOException if an I/O error occurs
88
+ */
89
+ @Override
90
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
91
+ throws ServletException, IOException {
92
+ processRequest(request, response);
93
+ }
94
+
95
+ /**
96
+ * Returns a short description of the servlet.
97
+ *
98
+ * @return a String containing servlet description
99
+ */
100
+ @Override
101
+ public String getServletInfo() {
102
+ return "Short description";
103
+ }// </editor-fold>
104
+
105
+ }
@@ -0,0 +1,19 @@
1
+ <html>
2
+ <head>
3
+ <title>Practical 3</title>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ </head>
7
+ <body>
8
+ <div>Request dispatcher</div>
9
+ <form action ="prac3" method="POST">
10
+ <label>Name: </label>
11
+ <input type="text" id="username" name="uname">
12
+ <br>
13
+ <label>Password:</label>
14
+ <input type="password" id="password" name="pass">
15
+ <<br>
16
+ <input type="submit">
17
+ </form>
18
+ </body>
19
+ </html>
@@ -0,0 +1,101 @@
1
+
2
+
3
+ package demo;
4
+
5
+ import com.mysql.cj.protocol.Resultset;
6
+ import java.io.IOException;
7
+ import java.io.PrintWriter;
8
+ import static java.lang.System.out;
9
+ import java.sql.Connection;
10
+ import java.sql.DriverManager;
11
+ import java.sql.ResultSet;
12
+ import java.sql.Statement;
13
+ import javax.servlet.RequestDispatcher;
14
+ import javax.servlet.ServletException;
15
+ import javax.servlet.annotation.WebServlet;
16
+ import javax.servlet.http.HttpServlet;
17
+ import javax.servlet.http.HttpServletRequest;
18
+ import javax.servlet.http.HttpServletResponse;
19
+
20
+
21
+ @WebServlet(name = "prac3", urlPatterns = {"/prac3"})
22
+ public class prac3 extends HttpServlet {
23
+
24
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
25
+ throws ServletException, IOException {
26
+ response.setContentType("text/html;charset=UTF-8");
27
+ String n=request.getParameter("uname");
28
+ String p=request.getParameter("pass");
29
+ int f=0;
30
+ String url = "jdbc:mysql://localhost:3306/ej_practical?useSSL=false";
31
+ String root = "root";
32
+ String pass = "";
33
+ String q="select * from login where uname='"+n+"' and pass='"+p+"'";
34
+ try (PrintWriter out = response.getWriter()) {
35
+ Class.forName("com.mysql.cj.jdbc.Driver");
36
+ Connection c=DriverManager.getConnection(url,root,pass);
37
+ Statement st=c.createStatement();
38
+ ResultSet rs=st.executeQuery(q);
39
+ out.println("<!DOCTYPE html>");
40
+ out.println("<html>");
41
+ out.println("<head>");
42
+ out.println("<title>Servlet prac3</title>");
43
+ out.println("</head>");
44
+ out.println("<body>");
45
+ if(rs.next()){
46
+ RequestDispatcher rd=request.getRequestDispatcher("prac/home.html");
47
+ rd.forward(request, response);
48
+ }
49
+ else{
50
+ RequestDispatcher rd=request.getRequestDispatcher("prac/prac3.html");
51
+ rd.include(request, response);
52
+ out.println("<h1>Please enter correct detail's</h1>");
53
+ }
54
+ out.println("</body>");
55
+ out.println("</html>");
56
+ }
57
+ catch(Exception e){
58
+ out.println("Error"+e.getMessage()+"message");
59
+ }
60
+ }
61
+
62
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
63
+ /**
64
+ * Handles the HTTP <code>GET</code> method.
65
+ *
66
+ * @param request servlet request
67
+ * @param response servlet response
68
+ * @throws ServletException if a servlet-specific error occurs
69
+ * @throws IOException if an I/O error occurs
70
+ */
71
+ @Override
72
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
73
+ throws ServletException, IOException {
74
+ processRequest(request, response);
75
+ }
76
+
77
+ /**
78
+ * Handles the HTTP <code>POST</code> method.
79
+ *
80
+ * @param request servlet request
81
+ * @param response servlet response
82
+ * @throws ServletException if a servlet-specific error occurs
83
+ * @throws IOException if an I/O error occurs
84
+ */
85
+ @Override
86
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
87
+ throws ServletException, IOException {
88
+ processRequest(request, response);
89
+ }
90
+
91
+ /**
92
+ * Returns a short description of the servlet.
93
+ *
94
+ * @return a String containing servlet description
95
+ */
96
+ @Override
97
+ public String getServletInfo() {
98
+ return "Short description";
99
+ }// </editor-fold>
100
+
101
+ }
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Practical 4</title>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ </head>
8
+ <body>
9
+ <div>cookies</div>
10
+ <form action="prac4" method="POST">
11
+ Enter the cookie <input type="number" name = "count" placeholder="Enter the number"/>
12
+ <button type="submit">Submit</button>
13
+ </form>
14
+ </body>
15
+ </html>
@@ -0,0 +1,88 @@
1
+ package demo;
2
+
3
+ import java.io.IOException;
4
+ import java.io.PrintWriter;
5
+ import javax.servlet.ServletException;
6
+ import javax.servlet.annotation.WebServlet;
7
+ import javax.servlet.http.Cookie;
8
+ import javax.servlet.http.HttpServlet;
9
+ import javax.servlet.http.HttpServletRequest;
10
+ import javax.servlet.http.HttpServletResponse;
11
+
12
+
13
+ @WebServlet(name = "prac4", urlPatterns = {"/prac4"})
14
+ public class prac4 extends HttpServlet {
15
+
16
+
17
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
18
+ throws ServletException, IOException {
19
+ response.setContentType("text/html;charset=UTF-8");
20
+ try (PrintWriter out = response.getWriter()) {
21
+
22
+ String c=request.getParameter("count");
23
+ Cookie[] cg=request.getCookies();
24
+ int vofc=Integer.parseInt(c);
25
+ if (cg != null) {
26
+ for (Cookie cp : cg) {
27
+ if (cp.getName().equals("count")) {
28
+ vofc = Integer.parseInt(cp.getValue());
29
+ }
30
+ }
31
+ }
32
+ vofc++;
33
+ Cookie g=new Cookie("count", String.valueOf(vofc));
34
+ g.setMaxAge(60 * 60 * 24);
35
+ response.addCookie(g);
36
+ /* TODO output your page here. You may use following sample code. */
37
+ out.println("<!DOCTYPE html>");
38
+ out.println("<html>");
39
+ out.println("<head>");
40
+ out.println("<title>Servlet prac4</title>");
41
+ out.println("</head>");
42
+ out.println("<body>");
43
+ out.println("<h1>Page Visits " + vofc + "</h1>");
44
+ out.println("</body>");
45
+ out.println("</html>");
46
+ }
47
+ }
48
+
49
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
50
+ /**
51
+ * Handles the HTTP <code>GET</code> method.
52
+ *
53
+ * @param request servlet request
54
+ * @param response servlet response
55
+ * @throws ServletException if a servlet-specific error occurs
56
+ * @throws IOException if an I/O error occurs
57
+ */
58
+ @Override
59
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
60
+ throws ServletException, IOException {
61
+ processRequest(request, response);
62
+ }
63
+
64
+ /**
65
+ * Handles the HTTP <code>POST</code> method.
66
+ *
67
+ * @param request servlet request
68
+ * @param response servlet response
69
+ * @throws ServletException if a servlet-specific error occurs
70
+ * @throws IOException if an I/O error occurs
71
+ */
72
+ @Override
73
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
74
+ throws ServletException, IOException {
75
+ processRequest(request, response);
76
+ }
77
+
78
+ /**
79
+ * Returns a short description of the servlet.
80
+ *
81
+ * @return a String containing servlet description
82
+ */
83
+ @Override
84
+ public String getServletInfo() {
85
+ return "Short description";
86
+ }// </editor-fold>
87
+
88
+ }
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <!--
3
+ To change this license header, choose License Headers in Project Properties.
4
+ To change this template file, choose Tools | Templates
5
+ and open the template in the editor.
6
+ -->
7
+ <html>
8
+ <head>
9
+ <title>TODO supply a title</title>
10
+ <meta charset="UTF-8">
11
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
+ </head>
13
+ <body>
14
+ <div>Session</div>
15
+ <form method="POST" action="prac5">
16
+ Enter the username:-<input type="text" name="uname">
17
+ <button>submit</button>
18
+ </form>
19
+ </body>
20
+ </html>
@@ -0,0 +1,88 @@
1
+
2
+ package demo;
3
+
4
+ import java.io.IOException;
5
+ import java.io.PrintWriter;
6
+ import javax.servlet.ServletException;
7
+ import javax.servlet.annotation.WebServlet;
8
+ import javax.servlet.http.HttpServlet;
9
+ import javax.servlet.http.HttpServletRequest;
10
+ import javax.servlet.http.HttpServletResponse;
11
+ import javax.servlet.http.HttpSession;
12
+
13
+ @WebServlet(name = "prac5", urlPatterns = {"/prac5"})
14
+ public class prac5 extends HttpServlet {
15
+
16
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
17
+ throws ServletException, IOException {
18
+ response.setContentType("text/html;charset=UTF-8");
19
+ try (PrintWriter out = response.getWriter()) {
20
+ String username = request.getParameter("username");
21
+ HttpSession hs = request.getSession(true);
22
+ Integer count = (Integer) hs.getAttribute("count");
23
+ if(hs.isNew()){
24
+ if(count==null){
25
+ count=1;
26
+ hs.setAttribute("count", count);
27
+ out.println("Session count : " + hs.getAttribute("count"));
28
+ }
29
+ }else {
30
+ count += 1;
31
+ hs.setAttribute("count", count);
32
+ out.println("Session extend : " + hs.getAttribute("count"));
33
+
34
+ }
35
+ /* TODO output your page here. You may use following sample code. */
36
+ out.println("<!DOCTYPE html>");
37
+ out.println("<html>");
38
+ out.println("<head>");
39
+ out.println("<title>Servlet prac5</title>");
40
+ out.println("</head>");
41
+ out.println("<body>");
42
+ out.println("<h1> sessions count " + count + "</h1>");
43
+
44
+ out.println("</body>");
45
+ out.println("</html>");
46
+ }
47
+ }
48
+
49
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
50
+ /**
51
+ * Handles the HTTP <code>GET</code> method.
52
+ *
53
+ * @param request servlet request
54
+ * @param response servlet response
55
+ * @throws ServletException if a servlet-specific error occurs
56
+ * @throws IOException if an I/O error occurs
57
+ */
58
+ @Override
59
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
60
+ throws ServletException, IOException {
61
+ processRequest(request, response);
62
+ }
63
+
64
+ /**
65
+ * Handles the HTTP <code>POST</code> method.
66
+ *
67
+ * @param request servlet request
68
+ * @param response servlet response
69
+ * @throws ServletException if a servlet-specific error occurs
70
+ * @throws IOException if an I/O error occurs
71
+ */
72
+ @Override
73
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
74
+ throws ServletException, IOException {
75
+ processRequest(request, response);
76
+ }
77
+
78
+ /**
79
+ * Returns a short description of the servlet.
80
+ *
81
+ * @return a String containing servlet description
82
+ */
83
+ @Override
84
+ public String getServletInfo() {
85
+ return "Short description";
86
+ }// </editor-fold>
87
+
88
+ }