-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHelloServlet.java
More file actions
26 lines (22 loc) · 760 Bytes
/
Copy pathHelloServlet.java
File metadata and controls
26 lines (22 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Install TomCat Apache to make system ready for running the Servlet Program
// Step 1 :- Install JDK
// Step 2 :- Set Path Variable
// Step 3 :- Set JAVA_HOME variable
// Step 4 :- Install TomCat Apache
// Step 5 :- Set the CLASSPATH variable
// ServletRequest and ServletResponse are Interfaces
// service() is like main()
import java.io.*;
import javax.servlet.*;
public class HelloServlet extends GenericServlet
{
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter pw = res.getWriter();
pw.println("<b> Hello Servlet");
pw.println("<br>");
pw.println("<u> First Servlet Program");
pw.close();
}
}