Exp14 St2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Exp14_St2:

import java.io.*;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;

/**
* Servlet implementation class Exp14_StudAct2
*/
@WebServlet("/Exp14_StudAct2")
public class Exp14_StudAct2 extends GenericServlet {
private static final long serialVersionUID = 1L;

/**
* @see GenericServlet#GenericServlet()
*/
public Exp14_StudAct2() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see Servlet#service(ServletRequest request, ServletResponse response)
*/
public void service(ServletRequest request, ServletResponse response) throws ServletException,
IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter pw=response.getWriter();
if(request.getParameter("t1").length()>6)
{
pw.println("Length>6");
}
else
{
pw.println("Length<6");
}
}

HTML File:

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="http://localhost:2123/Exp14_StAct/Exp14_StudAct2">
Password:<input type="password" name="t1">
<input type="submit" value="login">
</form>
</body>
</html>

Output:

You might also like