Write a Java Servlet to display a welcome message as a response to the web browser request for that servlet. Servlet should be stored at TOMCAT web server.

Standard

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.ServletException;

import javax.servlet.http.*;

 

public class showMsg extends HttpServlet {

 

protected void doGet(HttpServletRequest request,

HttpServletResponse response) throws ServletException, IOException {

response.setContentType(“text/html”);

PrintWriter out = response.getWriter();

out.println(“<html><title></title><body>”);

out.println(“Welcome “);

out.println(“</body>”);

out.println(“</html>”);

}

}

capture

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s