0% found this document useful (0 votes)
23 views

Package Import Import Import Import Import Import Import: / Servlet Implementation Class Hello

This document defines a servlet class called "hello" that extends the HttpServlet class. The servlet is mapped to the URL "/hello" and overrides the doGet method to print a simple HTML page with the text "Hello servlet!" to the response when accessed. It also defines an empty doPost method.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Package Import Import Import Import Import Import Import: / Servlet Implementation Class Hello

This document defines a servlet class called "hello" that extends the HttpServlet class. The servlet is mapped to the URL "/hello" and overrides the doGet method to print a simple HTML page with the text "Hello servlet!" to the response when accessed. It also defines an empty doPost method.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

package com.first.servlets; import java.io.IOException; import java.io.PrintWriter; import import import import import javax.servlet.ServletException; javax.servlet.annotation.WebServlet; javax.servlet.http.HttpServlet; javax.servlet.http.

HttpServletRequest; javax.servlet.http.HttpServletResponse;

/** * Servlet implementation class hello */ @WebServlet("/hello") public class hello extends HttpServlet { PrintWriter out; private static final long serialVersionUID = 1L; public hello() { super(); }

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { out.print("<html><body>Hello sevlet!</body></html>"); }

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }

You might also like