LoginServlet.java:-
import java.io.*;
import javax.servlet.*;
import java.sql.*;
public class LoginServlet extends GenericServlet
{
Connection con;
Statement st;
public void init(ServletConfig config)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","system");
}
catch(Exception e)
{
e.printStackTrace();
}
}

public void service(ServletRequest req,ServletResponse res)
{
try
{

String a=req.getParameter("uname");
String b=req.getParameter("pwd");
st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login where uname='"+a+"' and pwd='"+b+"' ");
PrintWriter out=res.getWriter();
if(rs.next())
{
out.println("Welcome to : "+a);
}
else
{
out.println("Wrong credentials");
}
}
Plz Subscribe to the Channel and if possible plz share with your friends. Thanks in advance

1. Compiler Design Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfC9pGMWuM6UWE3V4YZ9TZzM

2. Computer Organization and Architecture Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfDXDRzSLv1FfZ-SSA38SiC0

3. Operating Systems Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfDrdQuJTHIPmKMpa7eYVaPm

4. C Programming Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfBi_vnP7eo-QayXpzuMuOP6

5. Java Programming Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfDlQklXu3Hrtru-bm2dJ9Df

6. Data Structures Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfAhaLFnq4fQ5ASOqKd08-Us

7. Web Technologies Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfCwJmQkWF9sBUFLAdonjOMB

8. C++ Programming Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfCmm6ZT-R_33bxLY1fvcm_o

9. DAA ( Design and Analysis of Algorithms) Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfAG09GbFgMOLACfvbMplHsW

10. Python Programming Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfAKSXjEzeQhXdqTflN7qRlo

11. DMS ( Discrete Mathematical Structures ) Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfBB-4hXp4XI84HOCWkaBD63

12. C#.net Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfA8sKELgBkkUZxzGK1o5ll0

13. OOP through Python Playlist:-- https://www.youtube.com/playlist?list=PLXj4XH7LcRfANIIqVzBRTh0XDgZxu-QO2

14. LINUX ( UNIX )PROGRAMMING Playlist:- https://www.youtube.com/playlist?list=PLXj4XH7LcRfBiC4yNJ2dnRhE7ShGEB-WQ



catch(Exception e)
{
e.printStackTrace();
}
}

public void destroy()
{
try
{
st.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
web.xml:- replace < with less than and > with greater than
<web-app>
<servlet>
<servlet-name>ex4</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ex4</servlet-name>
<url-pattern>/login</url-pattern>

</servlet-mapping>
<welcome-file-list>
<welcome-file>login.html</welcome-file>
</welcome-file-list>

</web-app>

login.html:- replace < with less than and > with greater than

<html>
<body>
<form action="./login">
Username:<input type="text" name="uname"/><br/>
Password:<input type="text" name="pwd"/><br/>
<input type="submit" value="SUBMIT"/>
</form>
</body>
</html>