import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//extend HttpServlet class
public class Servlet_1 extends HttpServlet
{
private String message;
public void init() throws ServletException
{
// do initialization
message="Ashutosh Singh";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
{
//set response content type
response.setContentType("text/html");
// actual logic goes here
PrintWriter out =response.getWriter();
out.print("<html><body>");
out.print("<h1>"+message+"</h1>");
out.print("</body></html>");
}
public void destroy()
{
//do nothing
}
}
Thanks
Happy programming !
import javax.servlet.*;
import javax.servlet.http.*;
//extend HttpServlet class
public class Servlet_1 extends HttpServlet
{
private String message;
public void init() throws ServletException
{
// do initialization
message="Ashutosh Singh";
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
{
//set response content type
response.setContentType("text/html");
// actual logic goes here
PrintWriter out =response.getWriter();
out.print("<html><body>");
out.print("<h1>"+message+"</h1>");
out.print("</body></html>");
}
public void destroy()
{
//do nothing
}
}
Thanks
Happy programming !
No comments:
Post a Comment