Back to: Java Servlets Tutorials
Creating Servlet using MyEclipse IDE
In this article, I am going to discuss how to use Create Java Servlet Application using MyEclipse IDE. Please read our previous article where we discussed how to use Create Servlet Application using Eclipse IDE.
How to use Create Servlet Application using MyEclipse IDE?
MyEclipse is a commercially available Java EE IDE created and maintained by the company Genuitec, a founding member of the Eclipse Foundation. MyEclipse is built upon the Eclipse platform and integrates both proprietary and open source code into the development environment.
Download MyEclipse from https://www.genuitec.com/products/myeclipse/download/
Follow the below steps to create the servlet in the MyEclipse IDE:
- Create a web project.
- Create an HTML file.
- Create a servlet.
- Start the MyEclipse Tomcat server and deploy the project.
Step1: Create a web project
For creating a web project click on File Menu -> New -> Web project option from the Context menu as shown in the below image.
It will open the following “New Web Project” window. Here you need to give the Project name and other details and finally click on the Finish button as shown in the below image.
Once you click on the Finish button, it will create the Project for us,
Step2: Create the HTML file.
For creating an HTML file, right-click on the project -> New -> HTML which will open the following Create a new HTML Page window. Here you need to provide the HTML file name e.g. MyHtml.html and click on the Finish button as shown in the below image.
Once you click on the Finish button, an HTML file is created named MyHtml.html. Now open the MyHtml.html file and modified the code as shown below.
Step3: Create the Servlet
For creating a servlet click on File Menu -> New -> servlet option as shown in the below image.
It will open the “Create a new Servlet” window as shown in the below image. Give a meaningful name to your servlet such as “Hello” and click on the Next button as shown in the below image.
Once you click on the Next button, it will open the following window. Here, you simply verify the details and click on the Finish button as shown in the below image.
Once you click on the Finish button, a servlet file is created with the name Hello.java. Now let’s write the servlet code here.
Now change the welcome file as MyHtml.html in place of index.jsp.
Step4: Start the server and deploy the project
For starting the server and deploying the project in one step Right-click on your project -> Run As -> MyEclipse server application.
You can see that the default page of your project is open, write your name -> go.
Enter your name here and click “go”.
In the next article, I am going to discuss how to use Create Servlet Application using NetBeans IDE. Here, in this article, I try to explain how to use Create Servlet Application using MyEclipse IDE. I hope you enjoy this Create Servlet Application using MyEclipse IDE article.