The New Visual Web Application Wizard for NetBeans Visual Web Pack 5.5
By poting on Nov 29, 2006
New Project Wizard: Choose Project
You use the New Project wizard to create a new IDE project.
To open the New Project wizard, choose File > New Project (Ctrl-Shift-N). More project architecture details can be found in my previous weblog, "Understand the NetBeans New Web Application Wizard".
New Visual Web Application Wizard: Name and Location
The New Visual Web Application wizard creates a new standard project containing an empty visual web application. You open the New Visual Web Application wizard by opening the New Project wizard and selecting the Visual Web Application template from the Web category.
In the Name and Location page, you have to set the following properties:
- Project Name. Specifies the display name of the project. This name is also used to create the project folder and the context path.
- Project Location. Specifies the location where you want to store the project metadata and source code.
- Project Folder. Specifies the folder where you want to store the project metadata and source code. The folder is a concatenation of the project location and the project name.
- Default Java Package. Specifies the default package to hold the backing files for the JSF webforms that are created. The initial name for this package is derived from the project name.
- Source Structure. Specifies how your web application will be
Web application source files can be structured according to one of the following two recommendations. The recommendations are intended to assist you with organizing the files and directories associated with an application project in a logical fashion. When you create a web application, you must choose according to which recommendations your sources are to be structured:
- Java BluePrints. The Java BluePrints Project Conventions specify recommended conventions for structuring enterprise applications or web applications.
- Jakarta. The Jakarta recommendations specify recommended conventions for structuring web applications.
- JSP pages and JSP segments.
- Java class files for the servlets, filters, and listeners.
- Java class files for the classes that the JSP pages, applets, servlets, filters, and listeners depend on such as JavaBeans components. Optionally, you can package these classes as library JAR files.
- Static documents, such as HTML files, images, sound files, and so on.
- Tag files and tag segments.
- Custom tag libraries with tag library descriptor files (TLD files). TLD files are typically included in the tag library's JAR file.
- web.xml. The general web application deployment descriptor that configures deployment settings for components belonging to a web application, such as servlets and JSP files.
- sun-web.xml. The server-specific deployment descriptor that configures deployment settings for the Sun Java System Application Server.
- context.xml.The server-specific deployment descriptor that configures deployment settings for the Tomcat Web Server.
About Web Applications
A web application is an application written for the Internet, including those built with Java technologies such as JavaServer Pages and servlets, as well as those built with non-Java technologies such as CGI and Perl.
A web application roughly corresponds to the J2EE term web application module. This is a deployable unit that consists of one or more web components, other resources, and web application deployment descriptors, contained in a hierarchy of directories and files in a standard web application format.
Creating Web Components
A web component is an object that provides services in response to requests, within the context of a web application.
The main web components are as follows:
Before you can create a web component, you must create a web application to contain it.Creating Web Applications
Web applications have a defined folder structure. A web application is usually packaged and deployed as a web archive (WAR) file, although a web application does not always have to be packaged in order to be deployed.
A web application must contain a deployment descriptor file ( WEB-INF/web.xml). A web application can contain one or more web components.Configuring Web Application Deployment Descriptors
Deployment descriptors are XML-based text files whose elements describe how to assemble and deploy a module to a specific environment. The elements also contain behavioral information about components not included directly in code.
For web applications, there are three types of deployment descriptors:
The web root (document base) folder corresponds to the highest level of the project. The illustrations show the JSP files in both the root folder and the WEB-INF folder. You cannot directly access JSP files that are under the WEB-INF folder. These JSP files can be accessed only by another JSP file or by a servlet, such as by a forwarding request.
TLD files are typically packaged in the tag library's JAR file. If not, place the TLD file in the WEB-INF folder or subfolder.
Note that the Tomcat Web Server does not support .zip files in the WEB-INF/lib folder.
- Server. Specifies the web application's server. Only servers that
are registered with the
IDE are available to be selected here:
- For versions of the IDE that are bundled only with the Tomcat Web Server, the Tomcat Web Server is automatically registered in the IDE.
- For versions of the IDE that are bundled with both the Tomcat Web Server and the Sun Java System Application Server, both servers are automatically registered in the IDE.
- J2EE Version. Specifies the J2EE level against which your web application will run.
- Source Level Recommendations. One of the following checkboxes
will appear if JDK 1.5 is set as the default platform in the
Java Platform Manager. The J2EE 1.4 and J2EE 1.3 specifications do not
recommend JDK 1.5. Therefore, if you want to create a portable application,
select the appropriate checkbox:
- Use JDK 1.4 and Set Source Level to 1.4. This checkbox appears if JDK 1.4 is available in the Java Platform Manager. Select this checkbox to set both your JDK level and your source level to 1.4.
- Set Source Level to 1.4. This checkbox appears if JDK 1.4 is not available in the Java Platform Manager. Select this checkbox so that at least your source level is set to 1.4.
- Set as Main Project. Sets the newly created project as the main project.
Setting the Main Project
When you develop a large application consisting of numerous source directories, it is common to split up your code into separate projects. Of these projects, one is typically the entry point for your application and contains the application's main class.
To tell the IDE which of your projects is the main entry point for your application, you set one project to be the main project. The IDE provides commands that act on the main project. For example, running the Build Main Project command builds both the main project and all of its required projects, thereby ensuring that you all of your compiled classes are up-to-date. Only one project can be the main project at any time.