0% found this document useful (0 votes)
38 views7 pages

ChatLog Refresher Program - Java Full Stack - C Programming - Python - Batch1 - Virtual Training at NEC 2021-10-23 13 - 01

- Chirag Yadav joined the meeting by phone as his laptop mic was not working - Monica shared code for a login form and servlet to connect to a MySQL database and authenticate users - Several users tested logging in with different usernames and passwords - Monica continued sharing and explaining code examples for servlets and handling requests

Uploaded by

Chirag yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views7 pages

ChatLog Refresher Program - Java Full Stack - C Programming - Python - Batch1 - Virtual Training at NEC 2021-10-23 13 - 01

- Chirag Yadav joined the meeting by phone as his laptop mic was not working - Monica shared code for a login form and servlet to connect to a MySQL database and authenticate users - Several users tested logging in with different usernames and passwords - Monica continued sharing and explaining code examples for servlets and handling requests

Uploaded by

Chirag yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 7

Chat Log      C:\Users\chira\Documents\ChatLog Refresher Program _Java Full stack

_ C Programming _ Python_ _Batch1_ Virtual Training at NEC 2021_10_23 13_01.rtf

Chirag Yadav (to Everyone): 10:32: i am joining with phone alsoso that i can speak
because my laptop mic is not working
Chirag Yadav (to Everyone): 10:32: laptop
Monica (to Everyone): 11:15: <!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="LoginServlet" method="post">
Name:<input type="text" name="username" /><br />
<br /> Password:<input type="password" name="userpass" /><br />
<br /> <input type="submit" value="login" />
</form>
</body>
</html>

Monica (to Everyone): 11:17: response.setContentType("text/html");   


        java.io.PrintWriter out = response.getWriter();   
        int f=0;           
        String n=request.getParameter("username");   
        String p=request.getParameter("userpass");   
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/javadb", "root", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from login");
while (rs.next()) {
if(n.equals(rs.getString(1)) && p.equals(rs.getString(2))) {
out.print("Welcome "+n);
f=1;
break;
}
          
}
if(f==0)
out.print("Sorry username or password error");
con.close();
} catch (Exception e) {
System.out.println(e);
}

     

Monica (to Everyone): 11:19: create table login (uname varchar(10),pass varchar(10));
Monica (to Everyone): 11:21: INSERT INTO login VALUES
('NEC', 'nec'),
('admin', '1234'),
('user','pass');
Naveen Kumar Mittal (to Everyone): 11:24: Welcome NEC
K Prasanna Kumar (to Everyone): 11:24: Welcome NEC
Abhishek Rana (to Everyone): 11:24: Welcome NEC

K Prasanna Kumar (to Everyone): 11:24: Sorry username or password error


Kushagra Gupta (to Everyone): 11:34: Welcome NEC

Akshay Singh (to Everyone): 11:39: YES


K Prasanna Kumar (to Everyone): 11:39: Yes
Kushagra Gupta (to Everyone): 11:39: Yes
Naveen Kumar Mittal (to Everyone): 11:39: Welcome admin
Abhishek Rana (to Everyone): 11:39: YES
Harshit Mimani (to Everyone): 11:39: Yes
Chirag Yadav (to Everyone): 11:39: yes
Monica (to Everyone): 11:49: response.setContentType("text/html");   
          java.io.PrintWriter out = response.getWriter();   
          int f=0;           
          String n=request.getParameter("username");   
          String p=request.getParameter("userpass");   
    try {
      Class.forName("com.mysql.jdbc.Driver");
      Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/javadb", "root", "");
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery("select * from login");
      while (rs.next()) {
        if(n.equals(rs.getString(1)) && p.equals(rs.getString(2))) {
            out.print("Welcome "+n);
            f=1;
            break;
    }
             
   }
      if(f==0)
        out.print("Sorry username or password error");
      con.close();
    } catch (Exception e) {
      System.out.println(e);
  }
Monica (to Everyone): 12:10:
http://www.java2s.com/Code/Jar/m/Downloadmysqlconnectorjar.htm
Akshay Singh (to Everyone): 12:14: I tought that it is a jre issue
Monica (to Everyone): 12:24: response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
int f = 0;
String n = request.getParameter("username");
String p = request.getParameter("userpass");
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/javadb", "root", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from login");
while (rs.next()) {
if (n.equals(rs.getString(1)) && p.equals(rs.getString(2))) {
out.print("Welcome " + n);
f = 1;
break;
}
}
if (f == 0)
out.print("Sorry username or password error");
con.close();
} catch (Exception e) {
System.out.println(e); }
Monica (to Everyone): 12:25: <!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="LoginServlet" method="post">
Name:<input type="text" name="username" /><br />
<br /> Password:<input type="password" name="userpass" /><br />
<br /> <input type="submit" value="login" />
</form>
</body>
</html>

Monica (to Everyone): 12:44: Start a new “Dynamic Web Project” : PrjServletChain
Add the web.xml file
Add two Servlets:
Serv1
Serv2

Monica (to Everyone): 12:46: response.getWriter().append("Served at:


").append(request.getContextPath());
response.sendRedirect("Serv2");

Monica (to Everyone): 12:48: response.getWriter().append("Served at:


").append(request.getContextPath());
java.io.PrintWriter out=response.getWriter();
out.println("<h1>This is Serv2 redirected from Serv1</h1>");

Akshay Singh (to Everyone): 12:50: Served at: /PrjServletChain


This is Serv2 redirected from Serv1
Harshit Mimani (to Everyone): 12:50: Served at: /PrjServletChain
This is Serv2 redirected from Serv1
shivendra gupta (to Everyone): 12:50: Served at: /PrjServletChain
This is Serv2 redirected from Serv1
Abhishek Rana (to Everyone): 12:50: Served at: /PrjServletChain
This is Serv2 redirected from Serv1

Shipra Yadav (to Everyone): 12:50: Served at: /PrjServletChain


This is Serv2 redirected from Serv1
Naveen Kumar Mittal (to Everyone): 12:50: Served at: /PrjServletChain
This is Serv2 redirected from Serv1
Challa Bhavya (to Everyone): 12:50: Served at: /PrjServletChain
This is Serv2 redirected from Serv1
K Prasanna Kumar (to Everyone): 12:51: Served at: /_PrjServletChain
This is Serv2 redirected from Serv1
Shivaksh Ahalawat (to Everyone): 12:51: Served at: /PrjServletChain
This is Serv2 redirected from Serv1

Monica (to Everyone): 12:53: response.sendError(404, "No recognized search


engine specified.: Site Forbidden");

shivendra gupta (to Everyone): 12:54: HTTP Status 404 – Not Found

Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.

Monica (to Everyone): 12:54: Status code 301 SC_MOVED_PERMANENTLY


Status code 307 SC_TEMPORARY_REDIRECT
Status code 400 SC_BAD_REQUEST
Status code 403 SC_FORBIDDEN
Status code 404 SC_NOT_FOUND
Status code 405 SC_METHOD_NOT_ALLOWED
Status code 500 SC_INTERNAL_SERVER_ERROR

Akshay Singh (to Everyone): 12:54: HTTP Status 404 – Not Found

Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.54;
Naveen Kumar Mittal (to Everyone): 12:55: Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.

Abhishek Rana (to Everyone): 12:55: HTTP Status 404 – Not Found

Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.54
K Prasanna Kumar (to Everyone): 12:56: HTTP Status 404 – Not Found

TypeStatus Report

MessageNo recognized search engine specified.: Site Forbidden

DescriptionThe origin server did not find a current representation for the target resource
or is not willing to disclose that one exists.

Shipra Yadav (to Everyone): 12:57: Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server


did not find a current representation
for the target resource or is not
willing to disclose that one exists.

Shivaksh Ahalawat (to Everyone): 12:57: HTTP Status 404 – Not Found

TypeStatus Report

MessageNo recognized search engine specified.: Site Forbidden

DescriptionThe origin server did not find a current representation for the target resource
or is not willing to disclose that one exists.
Harshit Mimani (to Everyone): 12:58: HTTP Status 404 – Not Found

Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.54
Kushagra Gupta (to Everyone): 12:58: HTTP Status 404 – Not Found

Type Status Report

Message No recognized search engine specified.: Site Forbidden

Description The origin server did not find a current representation for the target
resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.54

Akshay Singh (to Everyone): 13:01: Thank you ma'am

You might also like