[go: up one dir, main page]

0% found this document useful (0 votes)
8 views2 pages

Java Prac 22 Pass

java

Uploaded by

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

Java Prac 22 Pass

java

Uploaded by

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

Input:

HTML File:

<!DOCTYPE html>
<html>
<body>
<form method="get" action="shashank_pass">
Percentage :<input type="number" name="p1">
<input type="submit" value="check">
</form>
</body>
</html>

Servlet File:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/shashank_pass")
public class shashank_pass extends HttpServlet
{
public void doGet(HttpServletRequest
req,HttpServletResponse res)throws
IOException,ServletException
{
String u1 = req.getParameter("p1");
int per = Integer.parseInt(u1);
PrintWriter pw = res.getWriter();
if(per>=40)
{
pw.println("Pass :)");
}
else if(per<=40)
{
pw.println("Fail :(");
}
pw.close();
}
}
Output:

You might also like