Ns2 Installation

Topics: Java, JavaServer Pages, Integrated development environment Pages: 10 (1734 words) Published: April 25, 2013
An Introduction to Developing Java Web Applications

* Machine specification used in this task
* Pre requirement
* Setting Up a Web Application Project
* Creating and Editing Web Application Source Files
* Creating a Java Package and a Java Source File
* Generating Getter and Setter Methods
* Editing the Default JavaServer Pages File
* Creating a JavaServer Pages (JSP) File
* Building and Running a Web Application Project
The original tutorial can be found at netbeans.org. All credits must go to the original authors. In this tutorial we try to refine all the steps to more details using screen shots.  
Machine specification used in this task are:
* Intel Pentium Core 2 Duo, 2.2 GHz,
* Windows XP Pro SP2 + periodical patches + periodical updates… * 2 GB DDR2 RAM
* 17” SyncMaster 713N monitor.
Pre requirement
1.      NetBeans 6.x.x
2.      To work through this tutorial, you must have a server registered in the IDE. The Web and Java EE installation enables you to optionally install and register the Apache Tomcat servlet container 6.0.14, and the GlassFish V2 application server. 3.      If you are installing NetBeans IDE for the first time, you need to have the Java SE Development Kit (JDK) installed. The JDK includes the Java Runtime Environment (JRE), as well as various tools and API's necessary for development in Java.

Setting Up a Web Application Project
1.      Choose File > New Project (Ctrl-Shift-N) from the main menu. Under Categories, select Web. Under Projects, select Web Application then click Next.  


2.      In Step 2, enter HelloWeb in the Project Name text box. Notice that the Context Path (i.e., on the server) becomes /HelloWeb. 3.      Specify the Project Location to any directory on your computer. For purposes of this tutorial, this directory is referred to as $PROJECTHOME. 4.      Select the server to which you want to deploy your application. Only servers that are registered with the IDE are listed. In this case we select GlassFish V2. Click Next.  


5.      Leave the Set as Main Project option selected and click Finish. The IDE creates the $PROJECTHOME/HelloWeb project folder. The project folder contains all of your sources and project metadata, such as the project's Ant build script. The HelloWeb project opens in the IDE. The welcome page, index.jsp, opens in the Source Editor in the main window. You can view the project's file structure in the Files window (Ctrl-2), and its logical structure in the Projects window (Ctrl-1):  

Creating and Editing Web Application Source Files
Creating and editing source files is the most important function that the IDE serves. After all, that is probably what you spend most of your day doing. The IDE provides a wide range of tools that can compliment any developer's personal style, whether you prefer to code everything by hand or want the IDE to generate large chunks of code for you.  

Creating a Java Package and a Java Source File
1.      In the Projects window, expand the Source Packages node. Note the Source Packages node only contains an empty default package node.  

2.      Right-click the Source Packages node and choose New > Java Class. Enter NameHandler in the Class Name text box and type org.mypackage.hello in the Package combo box. Click Finish. Notice that the new NameHandler.java file opens in the Source Editor.  


3.      In the Source Editor, declare a String variable by typing the following line directly below the class declaration:  
String name;
4.      Add the following constructor to the class:
public NameHandler()
{ }
5.      Add the following line in the NameHandler() constructor:  
name = null;

Generating Getter and Setter Methods
1.      Right-click the name field in the Source Editor and choose Refactor > Encapsulate Fields. The Encapsulate Fields dialog...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay on Red Hat Enterprise Linux 5.3 Installation Guide
  • Installation Art Essay
  • Installation Art Essay
  • Installation Art and Theatrical Experience Essay
  • Installation Artwork Essay
  • Installation Art Essay
  • Ns2 Paper
  • Windows Installation Essay

Become a StudyMode Member

Sign Up - It's Free