TxtWeb Hello World

Step 1:  Download the eclipse, 

http://www.eclipse.org/downloads/

Step 2:  Add the google plugin for txtweb in eclipse

Step 3:  New -> other -> Web application project,

and paste the below code,

package com.agn.meaning; //Package name for the app

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")

public class MeaningServlet extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/html"); // Remember to set your response to text/html for the app to work properly.
resp.getWriter().println(""+"Hello World"+""); // Whatever is inserted within the body tag is taken as a response and sent to the user. 
}

}

and run the program as follows,

and type http://localhost:8888 in the browser then the output is looks like this,

 

Thanks for reading this post…………!!!!

Leave a Reply