Running Servlet from Netbeans

This tutorial assuming you are going to create a project using JSP + Servlet + Javabeans

Starting:

  1. Open Netbeans.

Creating a project (if you do not have one yet or you wish to have a new one):
  1. File > New Project. "New Project" window appears.
  2. In the "Choose Project" step, choose Java Web > Web Application. Click Next.
  3. In the "Name and Location" step, enter your "Project Name". In this case, we use 'MyServlet'. You may locate your Project Location & Project Folder. We are going to use the default. Click Next.
  4. In the "Server and Settings" step, choose your Apache Tomcat server. I'm going to use 'Java EE 5' for "Java EE version".
  5. We are not going to use any "Frameworks". Just click Finish.

Your project will be created and opened. See that in "Projects" window.


Creating a servlet file:

  1. In the "Project" window, right click your project name node. In our case, it is 'MyServlet'. Choose New > Servlet. "New Servlet" window appears.
  2. It is directly goes to second step which is "Name and Location". Put yours. We are going to use 'MyServletFile'. Click Next.
  3. Leave the default settings in the "Configure Servlet Deployment". Click Finish.

There goes your 1st servlet file. Refer image below:


You may see default servlet code template readily created for you.

(Click for larger view)

You may do stuff in servlet. Compile & run it.

My reference(s): Java Servlet - Re: how can i run servlet in netbeans

0 comments:

Post a Comment

About this blog

This blog is created just for my 'nota kaki' of Java. I'm quite a forgetful person that I always lost my notes & have to reopen pages to look at it back. Going through that takes times. To avoid that, I've decided to write them in here & share with others. Some info I found from other pages will be credited to whom it should be. If I did not do so, please remind me since.. you know how such forgetful I am.

First of all, the credits goes to Software Department of KRIM Network Sdn. Bhd. Though many 'things' we have gone through.. I really love you all especially him :D

Caution! I do not accept any 'praises' or something like that. Hate it! Questions regarding JAVA is acceptable. Sharing info is most welcomed.

Enjoy the notes