Wednesday May 14, 2008

Use Facelets Support Modules on NetBeans 6.1

To use the Facelets support modules that we have downloaded or built from the source in my pervious blog, 'Build and Install Facelets Support Modules on NetBeans 6.1', I will briefly describe how these support modules will help your development works here.

Create Facelets Support Web Project

After installed the Facelets Support, you will find a new entry 'Facelets' in the Frameworks panel when you create a new web project. Select and check this entry before clicking on Finish. Multiple frameworks selection should work but is not a supported feature as there is no much testing has been done here.

As you can see, options for 'JavaServer Faces Configuration' are all non-editable because the project creating currently only supports the default settings. However, it is still possible to modify them after the project has been created.

  • Debug: control the facelets.DEVELOPMENT parameter in the web.xml file.
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>false</param-value>
    </context-param>
    Note: The parameter, facelets.DEVELOPMENT, is not required, but allows you to use the error-handling facility of Facelets. The browser will show more interesting error handling message, stack trace, component tree, and scoped variables if you enabled it.

  • Skip Comments: control the facelets.SKIP_COMMENTS parameter in the web.xml file.
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    Note: Once you are using Facelets you are perhaps interested in putting some comments to your XHTML template. But not every component likes this, because the comments are interpreted as regular components and not every component allows every other component to be its child. To handle those comments without any side effect, add facelets.SKIP_COMMENTS to your project's web.xml file with true value.

  • Create Example Facelets Files: create a simple welcome page.

  • Libraries: the bundled Facelets libraries 1.1.14 are default selected. You may create your own version of library or just do not append any in case you plan to have your own copy of Facelets support libraries installed in your target servers. The concept is the same as seen in the 'JavaServer Faces' framework.

    Note: You may want to create a new Facelets library for different version or the latest distribution got from the Facelets project page. Check the Create New Library under the Libraries tab, use the Browse file chooser to locate the folder where you unzipped the Facelets distribution and enter a meaningful Version number for later reference. The IDE validates the folder if it contains jsf-facelets.jar and a lib directory. The newly created library will later be shown in the Library Manager as well.

To see what you have for the new Facelets project, expand the folder nodes under the Project panel.

  • default.css: a default Cascading Style Sheets (CSS).

  • forward.jsp: a default welcome JSP page that has been defined in web.xml file. The contents have jsp:forward to the Facelets page template-client.xhtml.

  • template-client.xhtml: the real welcome Facelets page.

  • template.xhtml: the ui:composition template used by the welcome Facelets page template-client.xhtml.

  • faces-config.xml: the JavaServer Faces configuration file. The definition of a Facelets view handler is included.

  • Facelets 1.1.14 jar files: the bundled Facelets libraries needed for the Facalets projects. If you are using a server that does not directly support the JSF RI, then the bundled JSF RI libraries will also be included.
The IDE recognizes a file as a Facelets file if:
  • it has xhtml extension
  • its root tag includes http://java.sun.com/jsf/facelets in the list of namespaces
You may want to try the one-click deploy toolbar button (the green arrow) now to see the simple welcome Facelets been deployed on your browser.

Add more Facelets Pages and Contents

Now we are going to add more interesting contents to our Facelets project. When you focus on the Facelets .xhtml editor, you will notice that there are extra palettes available for your Facelets pages.

Let's add more JSF components into our boring welcome page by drag-n-drop the palette to the .xhtml editor. I have done here by just drag-n-drop an outputText and a commandButton to the editor and change their values to something meaningful.

    <ui:define name="body">
       Hello, this text comming from template client.
       <p>
          <h:outputText value="Go to Next Page:"/>
          <h:commandButton id="GO" value="GO" />
       </p>
    </ui:define>

Click on the Run button and you will see the following contents appear in your browser:

To add more Facelets files to your project, right click on the Web Pages node and select New -> Other... to invoke the New File dialog. Select the JavaServer Faces category and you will see there are 3 templates for the Facelets support:

  • Facelets Simple File: Create a simple Facelets file, an xhtml file which has <html> tag as a root tag and also defines ui namespace.

  • Facelets Template: Create a new Facelets template with the option to choose from eight layouts either be done through css file or table tag.

    When you select the CSS style, the IDE will generate an xhtml template file which uses the CSS <div> layout style and refers to a newly create cssLayout.css file under the css folder if it is not there. Otherwise, it will just refer to the exist cssLayout.css file without change the contents. If you select the Table style, the new xhtml template file will use the HTML <table> style and refer to a newly create tableLayout.css file instead. Both the cssLayout.css and tableLayout.css files contain the layout definitions.
  • Facelets Template Client: Create a new Facelets template client by the Template selected, mandatory. The IDE will parse the selected Template and generate <ui:define name="xxx"> tag in the client file for every <ui:insert name="xxx"> tag found. You can also choose either using the <html> tag or the <ui:composition> tag as the root tag in the generated template client.

Use Code Completion

The IDE provides tag code completion for all Facelets tag libraries that are included in the web project. The IDE scans the tag libraries definition file in the same way as Facelets does. These XML files can be referenced in the following two ways:

  • In a ";" delimitted list within your web.xml under the init-param "facelets.LIBRARIES".
  • In JAR's META-INF folder with a file extension of ".taglib.xml".

By default code completion offers the tags with default prefixes. Developers can add extra namespace definition or modify the default prefix. The code completion will adjust to include the new prefixes in the list.

The default prefixes are:

 xmlns="http://www.w3.org/1999/xhtml"  JSTL Core
 xmlns:ui="http://java.sun.com/jsf/facelets"  JSF - Facelets
More available prefixes are also available when drag-n-drop components from the Palette:
 xmlns:f="http://java.sun.com/jsf/core"  JSF - core components
 xmlns:h="http://java.sun.com/jsf/html"  JSF - html components

The namespace will automatically be imported into the root tag when you drag-n-drop a Facelets component or by using the code completion to add one.

Add Facelets component by Code Completion: Namespace automatically been added into the root tag:

Extra html tags support for the attribute jsfc (JavaServer Faces Component) are available (see Facelets developer documentation) from the code completion.

Code Completion shows the attribute jsfc: Code Completion for the attribute jsfc:
 
Namespace automatically been added into the root tag:
By default, the Facelets tag code completion provides tag attributes for the following standard Facelets libraries:
  • http://java.sun.com/jsf/facelets
  • http://java.sun.com/jsf/html
  • http://java.sun.com/jsf/core
  • http://java.sun.com/jstl/core
  • http://java.sun.com/jsp/jstl/functions
The IDE also scans the project classpath for all tld files. The code completion will provide extra attribute support if the tld file defines the Facelets Tag library. Their associate dynamic help will also be provided.

Use Hyperlink

By using the Hyperlink, developers can fast navigate from one source to another reference. You can visualize the link by holding down the CTRL key and mouse over a hyperlink active area. After you see the text changed into a link, click on it by the left mouse button. An appropriate source should be open. The tables below briefly displays this feature in the Facelets support.

  • Hyperlinks in Facelets tags
    Example File opened
     <ui:composition template="/template.xhtml" the template source
     <ui:include src="/content/top.xhtml"/>  the source file

  • Other hyperlinks in Facelets files
    Example File opened
     <h3>from #{NumberBean.min} to #{NumberBean.max}</h3>  the faces configuration file on position where the managed bean been defined
     <h3>from #{NumberBean.min} to #{NumberBean.max}</h3>  the appropriate java file on position where the getter for the property been defined

Refactoring Support

The refactoring support processes all files in the list of JSF configuration files. Bean and Java class/method usages are found in bean and alias elements and their subelements, as well as elements in the util namespace. In the following examples, it creates 2 managed beans, ManagedBeans.java and ManagedBeans2.java. Right click on the ManagedBeans.java node and select Refactor -> Rename... and then click on Preview under the dialog. You will see the preview of refactoring ManagedBeans.java. The second example shows renaming the package name from foo to bar.

Example Refactoring UI
Managed Beans
Folder / Package

Move support associate with the refactoring is also provided. The following example shows the preview of moving ManagedBeans.java from package foo to package bar.

Example Move UI
Managed Beans
Save Delete support associate with the refactoring is also provided which will search the usage with preview.

Find usages

The Facelets support will plug into the Java find usages to show JSF beans definitions which refer to Java elements (classes, methods, fields, properties). The Find Usages action will be available for bean definitions as well, to show beans used by other beans. The following example shows how the managed bean file, ManagedBeans.java has been referred by the JSF configuration files and other bean files.

Example Usages UI
Managed Beans

Create Sample Projects

There are two sample projects included in these modules. The first one is Facelets Template Examples that shows the example of layouts usage. The second one is the well known Number Guess Example by using the Facelets. You may simply create the project and deploy to see the Facelets in your browser.

Thursday May 08, 2008

Build and Install Facelets Support Modules on NetBeans 6.1

There are lots of requests that asking when and how the Facelets support be available on NetBeans 6.1. Yes, there is plan to officially release the support NBMs by the update center for NetBeans 6.1. We are currently working on that to resolve several compatible issues and migrate the internal APIs usage to NetBeans 6.1. When it is ready for the final release, we will announce it and make it available and show them under the Available Plugins list of NetBeans 6.1.

Build from Sources

According to the Open Sources concept, any users or developers can always pre-build their latest binaries and try/test before the official releases. This is also true for the Facelets plugin and believe me, it's very simple and can be done in just minutes! We have already done many tasks for the NetBeans 6.1 migration to ease the build requirement.

  1. Install your NetBeans 6.1 if you have not yet done so. You can get the installer from the NetBeans 6.1 download page.
     
  2. Get the sources: you can use the NetBeans GUI or simply your system command line to get the Facelets Support sources.

    • By NetBeans GUI: Invoke the CVS Checkout dialog by menu Versioning -> CVS -> Checkout..., fill the CVS Root (:pserver:your_userid@cvs.dev.java.net:/cvs) and Password, and click on Next.

      In the next dialog, use 'nbfaceletssupport' as the Module name and enter your planned working directory as the Local Folder, and click on Finish.

      After the IDE finished the checkout, it asks whether to open the projects or not, click on Open Project... (see next step)
       
    • By Command Prompt: Alternately you can checkout the CVS sources by just few command lines if you prefer.
      cvs -d :pserver:your_userid@cvs.dev.java.net:/cvs login
      cvs -d :pserver:your_userid@cvs.dev.java.net:/cvs checkout nbfaceletssupport
  3. Open the Facelets projects: Under NetBeans IDE, use menu File -> Open Projects... to invoke the Open Project dialog, select the Facelets projects and then click on Open Project.
  4. Build the NBMs: Under the Projects panel, right click on the Facelets Suite node and select the Create NBMs context menu to build all needed plugin NBMs.

    Now you have done the build and all 4 NBMs can be found under the following directory that you may want to copy to somewhere for your later use:
    nbfaceletssuite/build/updates/org-netbeans-modules-web-frameworks-facelets.nbm
    nbfaceletssuite/build/updates/org-netbeans-libs-facelets.nbm
    nbfaceletssuite/build/updates/org-netbeans-modules-web-frameworks-facelets010114.nbm
    nbfaceletssuite/build/updates/org-netbeans-modules-web-jsf-simplesnippets.nbm
    If you do want to skip the 'build from sources' steps, you may just download these NBMs (nbfaceletssupport-6.1.zip) that I have done.

Install the Facelets Support NBMs

The next step is to install the Facelets NBMs that we have just created into the IDE. You can invoke the Plugins dialog by menu Tools -> Plugins, select the Downloaded tab and click on Add Plugins... to open these 4 NBMs.

Then click on Install, follow few Next/Continue/Finish clicking and accept the license agreements, finally your IDE is ready for the Facelets Support, on the latest released NetBeans 6.1!

Uninstall the Facelets Support

In case you need to uninstall the Facelets Support for any reason, use the menu Tools -> Plugins to get the dialog, select the Installed tab and choose 'Facelets Support', 'Simple JSF/Facelets Snippets', and 'Facelets Library 1.1.14', then click on Uninstall to uninstall the support.

Saturday Oct 06, 2007

Import Creator 2 JSR-168 Portlet Projects into NetBeans 6.0

Visual Web JSF Portlet Builder feature was dropped for NetBeans 5.5 due to schedule/resource constraints. As you may already know, Visual Web in NetBeans 6.0 product release will not support the JSR-168 portlet that Sun Java Studio Creator 2 supports as well. Creator 2 users are relying on this feature and cannot move to NetBeans until it is on par with what they have now. However, in this article, I will explain how to import your Creator 2 portlet projects into NetBeans 6.0 and continue to work on them and deploy them on OpenPortal Portlet Container and OpenPortal Portal Server from the NetBeans IDE. Hopefully, the Visual Web team will implement a solution to automate these manual steps and make it into an add-on download from the NetBeans update center.

There are 2 parts of tasks for this integration. The first part is to install and configure the Portlet Container on your NetBeans IDE. This is an one time only setup needed for NetBeans developers to use the open source software OpenPortal Project to develop and test their portlets. The second part is to import user's Creator 2 JSR-168 portlet projects from NetBeans 6.0 and deploy it on the OpenPortal portlet container.

Install and Configure the OpenPortal Portal Server (one time only setup):
  1. Install GlassFish Application Server:

    GlassFish is an open source enterprise application server. You can download the latest version of GlassFish Application server from here. There is no need to install separate GlassFish Application Server for portlet deployment if you have already installed it standalone or bundled by other IDE such as NetBeans.

  2. Install OpenPortal Portlet Container on GlassFish Application Server:

    The OpenPortal Portlet Container is an enterprise-class Portlet Container which is part of the overall OpenPortal Project. To install OpenPortal Portlet Container on the GlassFish Application Server, download the latest binary first and then follow the installation instructions in the Download page (1.0_01 binary is been used here).

    java -jar portlet-container-configurator.jar


  3. Install NetBeans Portal Pack 2.0 on NetBeans 6.0:

    Portal Pack 2.0 is a plug-in for NetBeans IDE; it provides supports to create JSR-168 portlet and the deployment of portlets from the NetBeans IDE. You can find the installation instructions for the plug-ins in its download page. Only the following 2 plug-ins are needed for this article:

    • Base PSFramework - Base framework library for portal server integration.
    • OpenSource PC - Plug-in to integrate OpenPortal Portlet Container


  4. Add OpenPortal Portlet Container on NetBeans 6.0:

    You can find more details and options of how to configure OpenPortal Portlet Container in your NetBeans IDE by using this user guide. Below are simple steps to add the server in the NetBeans IDE:

    • Select Tools > Servers
    • Click on "Add Server..."
    • Select "OpenPortal Portlet Container 1.0" from the list of available servers
    • Select "GlassFish" from the dropdown
    • Enter "GlassFish Home" and "Password" fields (Default password for GlassFish is "adminadmin";)


       
    • Click on "Next" and then "Finish" to accept all default values.

Import Creator 2 JSR-168 Portlet Project into NetBeans 6.0:
  1. Prepare your Creator 2 Project:

    I will use the Creator 2 tutorial Developing a Portlet Application to explain the migration. Before importing into NetBeans 6.0, remember to right click on the project node and select "Clean Project" to remove the Creator 2 bundled files that may conflict our later migration. Then copy the whole project to a new location.


  2. Open the Portlet Project from NetBeans 6.0:

    When opening the portlet project, a warning dialog shown with the message "Reference Problems" will appear. That is because the current Visual Web Pack does not directly support the JSR-168 Portlet specification. We can resolve this reference issue by doing the following steps:

    • Download the JSF/Portlet Integration Library file jsf-portlet.jar from OpenPortal JSF Portlet Bridge which allows JSF applications to run within a Portlet environment.
    • Right click on the Project node and select Properties. Select category "Packaging" and remove those 2 missing libraries, portlet-runtime and jsf-portlet-runtime. Then use "Add File/Folder" to add the Portlet Bridge jar file we just downloaded with the value "WEB-INF/lib" for Path in WAR field.

      Remove the missing libraries


      Add the JSF/Portlet Integration Library file


    • In the same Properties window, select category "Run" and change the Server to "OpenPortal Portlet Container 1.0".



    • Be careful to not use JDK 6 for "Source/Binary Format" under the category Sources. It will not work for most current servers!

  3. Deploy the Portlet Project on OpenPortal Portlet Container:

    Now we have the final project ready to deploy. Click on the green arrow button "Run Main Project (F6)" to deploy the portlet project on OpenPortal Portlet Container.

    You will see your portlet project deployed on your browser! If the server does not show, you can expand the Servers node under NetBeans IDE's Services tab until you see your portlet under the server OpenPortal Portlet Container 1.0. Right click on your portlet and select "Show Portlet". Or you can type the following URL in your browser to see all portlets that are currently deployed to the Portlet Container.

    http://localhost:8080/portletdriver/dt


  4. Download the Example Project:

    You can download the example project we used for this article.


Thursday May 10, 2007

Now you can extend your non-visual web project to Visual Web JSF project

Since Sun released Visual Web Pack for NetBeans 5.5 near end of 2006, lots of users asked whether they can extend their regular non-visual web project to use this visual editor. The answer is now no longer 'NO'!

Visual Web is now fully integrated with NetBeans web project in NetBeans 6.0. Unlike in NetBeans 5.5 or 5.5.1, you no longer see an individual project type Visual Web Application under the Web category when you create a new project. Instead, you use the standard Web Application type to create your new web project and after 2 'Next' clicks, check the Visual Web JavaServer Faces under the Frameworks step.

This Web Project integration also means that; Visual Web will support all the NetBeans web project functionalities that Creator and Visual Web Pack users long eager want to see like,

  • More Server support: Sun Application Server/GlassFish, Tomcat, JBoss Application Server, and BEA WebLogic Server.
  • Add to Enterprise Application: Lets you specify an existing enterprise application to which the web application will be added as a module.
  • More available New File support: Since Visual Web is now a standard web project plug-in, all supported web project templates are now also available to Visual Web project.
  • Latest web project features and bug fixing: Visual Web is no longer a forked project type from the standard web project, Visual Web users will always get the latest available web project features and receive the latest and fastest bug fixing.
  • ...

Still not impressed yet! OK, here is one that may encourage non-visual web developers start to migrate their web applications to use the visual JSF editor that is now available in the new Visual Web JSF framework.

Besides creating your Visual Web support web project by the above start-from-scratch steps, there are two ways to 'upgrade' your non-visual web project to use these Visual Web stuffs. Just right click on your regular web project and select Properties, under Frameworks category use Add... to add the Visual Web JavaServer Faces framework.

After clicked on the OK button, a default empty Visual Web page 'Page1.jsp' will be created for your web project in addition to all of the framework setup. Now you can link this new visual-editor-support JSF page to your non-visual JSP or HTML pages by adding:

<a href="./faces/Page1.jsp">JavaServer Faces Welcome Page</a>

The second even simpler way is to just add a Visual Web JSF Page to your regular web project. Right click on your regular web project and select New -> Others..., under Web category and choose Visual Web JSF Page file type. Then the Visual Web JavaServer Faces framework will be added into your web project with the Visual Web page name you selected.

You can try all of the above features by visiting the NetBeans IDE 6.0 Preview page and download the new IDE from there.

Wednesday Dec 06, 2006

The NetBeans Visual Web Pack 5.5 was officially released for production this morning!

What's changed?

  • Many, Many bug fixes
  • Updated AJAX components
  • New Tutorials, online help, and technical articles
Come take a look! NetBeans Visual Web Pack 5.5

Friday Dec 01, 2006

Project Logical View and Templates Differences from Creator 2 to Visual Web Pack

Visual Web Pack is released for NetBeans 5.5. Now you can use all the power of the NetBeans IDE with many of the great visual web application development features from Java Studio Creator. You can even open a Java Studio Creator 2 project from the Visual Web Pack. The question is what differences you will see between these two platforms especially from the point of the Projects view. In this blog, I will try to describe the 'addition' components that you will find under the new Visual Web Pack projects panel. Besides that, I will also list what extra templates that will be available for the Visual Web Application.

You can see from the following pictures how Visual Web Pack project logical view looks different from Creator 2.

Creator 2

Addition:

Visual Web Pack

  • WEB-INF folder under the Web Pages folder
     
  • Configuration Files folder
     
  • Server Resources folder
     
  • Test Packages folder
     
  • Test Libraries folder
     
  • Component Libraries folder

 

 

The Projects panel groups logical objects by category within projects. Choose Window > Projects to display this panel. The following table describes the top-level nodes.

Icon Folder Description
Project icon Project Name The root node for a Visual Web Application project.
Web pages folder icon Web Pages The .jsp pages, which include the visual presentation of a web page, such as JavaServer Faces components and static text. Also contains resources, such as stylesheets.
Theme icon Themes Coordinated sets of cascading stylesheet files, JavaScript files, and icon images that are applied to a page and the components in the page
Folder icon Page Navigation Provides access to the Page Navigation editor, which enables you to connect pages to one another in a multi-page web application.
Managed Beans icon Managed Beans Provides access to the managed-beans.xml file containing configuration information for JavaBeans objects that are used by the application.
Application Bean icon Application Bean By default, there is one application bean for each project. This bean has a runtime scope of Application and is where you store information that you want to preserve across all user sessions. Double-click this bean to view it in the Java Editor.
Request Bean icon Request Bean By default, there is one request bean for each project. This bean has a runtime scope of Request and is where you store information from the current page for use by the next page your application opens. Double-click this bean to view it in the Java Editor.
Session Bean icon Session Bean By default, there is one session bean for each project. This bean has a runtime scope of Session and is where you store information that you want to preserve across page requests for a single user session. Double-click this bean to view it in the Java Editor.
Configuration Files icon Configuration Files Deployment descriptor files, 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.
Server Resources icon Server Resources  
Source packages icon Source Packages The Java files in your project, such as the page beans containing the event handling and business logic for your application
Source packages icon Test Packages The test files in your project.
Libraries icon Libraries Library JAR files used by the application
Libraries icon Test Libraries Library JAR files used by the test files for your application
Component Libraries icon Component Libraries Library JAR files for libraries containing JavaServer Faces components that you have imported.
Data Source References icon Data Source References A node used to resolve data connection problems, especially with projects imported from Java Studio Creator 2 and Java Studio Creator 2 Update 1.

 

Many of the web components templates that are available for the NetBeans web project but not in Creator are now coming back in Visual Web Pack. From the following list, you can see the extra are pretty big. Meaning, Visual Web Pack users will have much more available web component templates for their web application than Creator.

Before listing the extra templates, one UI behavior is worth to mention here. When right click on the folder nodes under the project panel, the entries of available templates are context sensitive depend on which kind of folders you selected. Unlike NetBeans web project, entries of available templates are always fixed no matter what kind of folders has been selected.

Creator 2:

 

Visual Web Pack:

 

The following table lists the available web components templates for both Creator 2 and Visual Web Pack. As you can see, now Visual Web Pack users have much more available web component templates for their web application than Creator.

Category Creator 2 JSF Web Project Templates Visual Web Pack Project Templates
Visual Web (name for VWP)

Web Page (name for Creator 2)

  • Page
  • Page Fragment
  • HTML File
  • Redirect HTML File
  • Page
  • Page Fragment
  • JSP
  • Servlet
  • Filter
  • Web Application Listener
  • Tag Library Descriptor
  • Tag File
  • Tag Handler
  • HTML
  • XHTML
  • Redirect HTML File
Enterprise N/A
  • Service Locator
  • Caching Service Locator
  • Sun Deployment Descriptor
Managed Beans
  • Request Bean
  • Session Bean
  • Application Bean
  • Request Bean
  • Session Bean
  • Application Bean
Java Classes
  • Java Class
  • Empty Java File
  • Java Interface
  • Java Enum
  • Java Annotation Type
  • Java Exception
  • Java Main Class
  • JApplet
  • Applet
  • Java Package
  • Properties file (move to Other)
  • Java Class
  • Empty Java File
  • Java Interface
  • Java Enum
  • Java Annotation Type
  • Java Exception
  • Java Main Class
  • Java Package Info
  • JApplet
  • Applet
  • Java Package
JavaBeans Objects
  • JavaBeans Component
  • BeanInfo
  • BeanInfo w/o Icon
  • Java Package
  • JavaBeans Component
  • BeanInfo
  • BeanInfo w/o Icon
  • Customizer
  • Property Editor
  • Java Package
JUnit
  • Empty Test
  • Test for Existing Class
  • Test Suite
  • Java Package
  • Empty Test
  • Test for Existing Class
  • Test Suite
  • Java Package
Persistence N/A
  • Entity Class
  • Entity Classes from Database
  • Persistence Unit
  • Database Schema
Web Services N/A
  • Logical Handler
  • Message Handler
  • WSDL
  • Web Service
  • Web Service Client
  • Web Service from WSDL
Sun Resources N/A
  • JDBC Connection Pool
  • JDBC Resource
  • JMS Resource
  • JavaMail Resource
  • Persistence Resource
XML N/A
  • XML Document
  • DTD Entity
  • XML Schema
  • XSL Stylesheet
  • OASIS XML Catalog
  • XML Parsed Entity
  • Cascading Style Sheet
Resources
  • Cascading Stylesheet (move to Other)
  • Empty File (move to Other)
  • XML Document (move to XML)
  • DTD Entity (move to XML)
  • XML Parsed Entity (move to XML)
  • OASIS XML Catalog (move to XML)
N/A
Ant Build Scripts
  • Empty Ant Script
  • Empty Ant Script
  • Custom Task
Other N/A
  • Cascading Stylesheet
  • Properties File
  • Empty File
  • Folder
  • HTML File
  • XHTML File
Advanced
  • JavaServer Faces (JSF) Configuration File
  • Web Application Configuration
  • Managed Beans Configuration
  • Navigation Configuration
  • JavaServer Faces (JSF) Configuration File
  • Managed Beans Configuration
  • Navigation Configuration

Following table is the description of these available web components templates.

Category Template Description
Visual Web Page This template will create a new blank web page. Design the page by dragging components from the Palette.
Page Fragment This template will create a new blank web page fragment. Design the page by dragging components from the Palette.
JSP Creates new JSP file or JSP segment using either standard JSP syntax or XML syntax. JSP technology enables you to add dynamic behavior to web pages. A JSP file must be run on a JSP-enabled web server.
Servlet Creates a new servlet class. A servlet is a server-side Java class which runs within a web server.
Filter Creates a new filter class. Filters can pre-process a request before it reaches a servlet, post-process a response leaving a servlet, or do both. Filters can intercept, examine, and modify requests and responses.
Web Application Listener Creates a listener class. Lifecycle events let "listener" objects be notified when servlet contexts and sessions are initialized or destroyed, as well as when attributes are added or removed from a context or session.
Tag Library Descriptor Creates a Tag Library Descriptor (TLD) file, which can be used with JavaServer Pages (JSP) files. A tag library descriptor is an XML document that contains information about a library as a whole and about tags and tag files contained in the library. To add tags to TLD file, use the Tag Handler wizard or open the XML editor from the TLD node.
Tag File Creates an empty tag file. Use tag files for creating custom JSP tags. This is a JSP 2.0 facility that allows you to write tags using JSP syntax. Tag file authors are not required to know how write Java classes. Tag files should be placed under the /WEB-INF/tags directory of the web application.
Tag Handler Creates a new tag handler class. Tag handlers are server side Java components used to create custom tags for JSP files.
HTML Creates a new HTML file. You can edit the file in the IDE's Source Editor. You can view the file in a web browser by right-clicking the file's node in the Projects window and choosing View.
XHTML Creates a new XHTML Strict file. You can edit the file in the IDE's Source Editor. You can validate against the DTD using the context menu.
Redirect HTML This template creates an HTML page that can be used to redirect to another page or web location.
Enterprise Service Locator Creates an instance of the Service Locator J2EE design pattern. A service locator encapsulates the JNDI lookup code into a single class, reducing the proliferation of lookup code. This wizard does not cache lookup instances and is typically used in the business tier.
Caching Service Locator Creates an instance of the Service Locator J2EE design pattern. A service locator encapsulates the JNDI lookup code into a single class, reducing the proliferation of lookup code. The caching service locator pattern stores instances that are already resolved, which reduces subsequent lookups. This pattern is typically used in the web tier.
Sun Deployment Descriptor Creates default valid Sun Java System Application Server or Web Server deployment descriptor for your Java EE module or application.
Managed Beans Request Bean Using this template, you can create a new managed bean that is stored in request scope. The managed bean is added to the managed-beans.xml and is visible in the Application Outline.
Session Bean Using this template, you can create a new managed bean that is stored in session scope. The managed bean is added to the managed-beans.xml and is visible in the Application Outline.
Application Bean Using this template, you can create a new managed bean that is stored in application scope. The managed bean is added to the managed-beans.xml and is visible in the Application Outline.
Java Classes Java Class Creates a new plain Java class. This template is useful for creating new non-visual classes.
Empty Java File Creates an empty Java source file. No code is generated except for the required package statement. Use this template to create a class from scratch.
Java Interface Creates a new Java interface.
Java Enum Creates a new Java enum file. To be able to use enum files, your project must use JDK 5.0 or compatible.
Java Annotation Type Creates a new Java annotation type. To be able to use annotation type files, your project must use JDK 5.0 or compatible.
Java Exception Creates a new subclass of Exception with an optional detailed message.
Java Main Class Creates a new Java class with a main method permitting it to be run as a console application. If you want to design a visual application, you might prefer to use the JFrame template under Java GUI Forms, or an application skeleton under Java GUI Forms | Sample Forms.
Java Package Info Creates a new Java package-info. To be able to use package annotations, your project must use JDK 5.0 or compatible.
JApplet Creates a new JFC (Swing) applet. An applet is a Java class that can run in any Java-enabled browser. Note: This template does not contain form code that allows you to design the applet visually in the Form Editor. For visual design, start with the JApplet template under Java GUI Forms.
Applet Creates a new AWT (Abstract Window Toolkit) applet. An applet is a Java class that can run in any Java-enabled browser. Note: This template does not contain form code that allows you to design the applet visually in the Form Editor. For visual design, start with the Applet template under Java GUI Forms | AWT Forms.
Java Package Creates a package to hold Java source files. This package physically takes the form of an empty folder on your disk.
JavaBeans Objects JavaBeans Component Creates a new JavaBeans component. The created skeleton code contains a sample property and property change support.
BeanInfo Creates a new BeanInfo class. The BeanInfo is used as a description of how its associated JavaBeans component should behave and appear.
BeanInfo w/o Icon Creates a new BeanInfo class. The BeanInfo is used as a description of how its associated JavaBeans component should behave and appear.
Customizer Creates a Customizer panel for a JavaBeans component. The customizer can then be used during design time in the IDE to configure the bean.
Property Editor Creates a PropertyEditor class. Property editors are used at design time in IDEs to support editing of the properties of JavaBeans components.
Java Package Creates a package to hold Java source files. This package physically takes the form of an empty folder on your disk.
JUnit Empty Test Creates an empty JUnit test case.
Test for Existing Class Creates a simple JUnit test case for testing methods of a single class.
Test Suite Creates a test suite for all tests in a selected Java test package.
Java Package Creates a package to hold Java source files. This package physically takes the form of an empty folder on your disk.
Persistence Entity Class Creates an empty Java Persistence API entity class.
Entity Classes from Database Creates Java Persistence API entity classes based on an existing relational database. Entity classes are used to represent objects whose lifespan is longer than a typical program execution. This template creates an entity class for each selected table, complete with named query annotations, fields representing columns, and relationships representing foreign keys.
Persistence Unit Creates an JSR220 persistence unit. If persistence.xml doesn't exist, it is created.
Database Schema Creates a new persistent database schema file.
Web Services Logical Handler Creates a simple logical handler. This class is intended for you to customize to suit your needs.
Message Handler Creates a simple SOAP message handler. SOAP message handlers intercept the SOAP message as it makes its way from the client to the service and vice-versa. The generated class performs simple logging of the SOAP message request. This class is intended for you to customize to suit your needs.
WSDL Creates new WSDL file with embeded or imported XML schema.
Web Service Creates a skeleton web service. Web services are reusable software components that semantically encapsulate discrete functionality. Web services are accessible over standard protocols such as SOAP. The web services created by this template are deployed and run according to the JSR-109 and J2EE 1.4 standards.
Web Service Client Creates a web service client that is compliant with JSR-109.
Web Service from WSDL Creates a skeleton web service from WSDL file. Web services are reusable software components that semantically encapsulate discrete functionality. Web services are accessible over standard protocols such as SOAP. The web services created by this template are deployed and run according to the JSR-109 and J2EE 1.4 standards.
Sun Resources JDBC Connection Pool Wizard to create a new JDBC Connection Pool Resource.
JDBC Resource Wizard to create a new JDBC Resource.
JMS Resource Wizard to create a new JMS Resource. The resource created will be either a Connector Resource or a Admin Object Resource
JavaMail Resource Wizard to create a new JavaMail Resource.
Persistence Resource Wizard to create a new Persistence Resource.
XML XML Document Creates a new XML document. In the wizard, you can specify whether to have the file well formed, DTD constrained, or XML Schema constrained.
DTD Entity Creates a new document type definition (DTD). DTDs describe the tags that can be used in an XML file and indicate the valid arrangement of those tags.
XML Schema Creates an XML Schema document that specifies the namspaces and data type constraints for an XML document.
XSL Stylesheet Creates an empty extensible style sheet (XSL) document. Use XSL documents to specify display characteristics, tag conversions, and addressing mechanisms for your XML document.
OASIS XML Catalog Creates an OASIS XML Catalog file that maps external entity references to local resources. You can then add the catalog to DTD and XML Schema Catalogs in Runtime window.
XML Parsed Entity Creates an external parsed entity object.
Cascading Style Sheet Creates an empty cascading style sheet (CSS) document. Use a CSS to format the information contained in your XML document.
Ant Build Scripts Empty Ant Script An empty Ant build script.
Custom Task No description
Other Cascading Style Sheet This template creates a new simple cascading stylesheet (CSS) file.
Properties File Creates a resource bundle (.properties) file suitable for internationalizing applications by separating out all human-visible text strings from your code. Resource bundle files can also be used to collect other types of strings, such as properties for Ant scripts. The created resource bundle contains only one locale, but you can add additional locales from the created file's contextual menu. The bundle can be edited in a text file (property-file format) for a specific locale or in a table that displays information for all locales.
Empty File Creates an empty file with an arbitrary extension on your disk.
Folder Creates a new folder on your disk.
HTML File Creates a new HTML file. You can edit the file in the IDE's Source Editor. You can view the file in a web browser by right-clicking the file's node in the Projects window and choosing View.
XHTML File Creates a new XHTML Strict file. You can edit the file in the IDE's Source Editor. You can validate against the DTD using the context menu.
Advanced Managed Beans Configuration This template creates a new Managed Beans Configuration XML file that is used by a Visual Web Pack project. It is also known as managed-beans.xml.
Navigation Configuration This template creates a new navigation configuration XML file that is used by a Visual Web Pack project.
JavaServer Faces Configuration This template creates a new Faces Configuration XML file that is used by a Visual Web Pack project. It is also known as faces-config.xml. You can add your own customizations here, like locale preferences.

Wednesday Nov 29, 2006

The New Visual Web Application Wizard for NetBeans Visual Web Pack 5.5

NetBeans 5.5 and Visual Web Pack Technical Preview are Out! Now you can use all the power of the NetBeans IDE with many of the great visual web application development features from Java Studio Creator. To get started developing a Visual Web Application, create a new project then choose "Web->Visual Web Application".

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 structured.

    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.

    Java BluePrints

    Jakarta


      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:

      • JSP pages and JSP segments.
      • Applets.
      • 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.

      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:

      • 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 Root

      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.

Click Finish, the project is created on your computer and opened in the IDE. You can view its logical structure in the Projects window and its file structure in the Files window.

Friday Mar 03, 2006

Understand the NetBeans New Web Application Wizard

For some reasons I have been forced to learn the NetBeans Web Project in detail :-) To create a Web project by using NetBeans, the first thing users will face is the New Web Application Wizard. I think it's not as easy as looking into my kid's new microscope manual. Therefore, I decided to collect the information that I got from various places into this guide. They are actually mainly from the NetBeans JavaHelp related to this wizard.

Here it is!

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). Select a template category and a project template and click Next.

For each project category, there are two types of project templates:

  • Standard templates. Templates in which the IDE controls all source and classpath settings, compilation, running, and debugging. Standard project templates can contain one or more source folders and optionally one or more JUnit test folders.

    Source Folders

    In standard projects, you can have multiple source folders and multiple JUnit test folders for each J2SE, web, and EJB project. A single source folder cannot, however, be added to more than one project. If you need a source folder to be part of several projects, you should create a separate project for the source folder and add it to the classpath of each of your projects.

    Project Settings

    When you create a project from a standard project template, the IDE generates an Ant script that controls all aspects of program compilation, execution, and debugging.

    You can set basic project settings in the Project Properties dialog box by right-clicking a project node in the Projects window and choosing Properties. All changes are immediately registered in the project's Ant script. You can also set more complex options by editing the project's Ant script and properties file directly.

    The Project Folder

    Each standard project has a project folder where the IDE stores the Ant script, project metadata, and output folders. In projects with existing sources, you can place the project source directories in the same location as the project folder or in a separate location. In empty projects, the source root is always in the same location as the project directory.

    The following table lists the contents of a project folder:

    Item Description
    build.xml The build script called by the IDE. This build script only contains an import statement that imports targets from nbproject/build-impl.xml. Use the build.xml to override targets from build-impl.xml or to create new targets.
    nbproject The directory that contains the project Ant script and other metadata. This directory contains:
    • build-impl.xml. The IDE-generated Ant script. You should never edit build-impl.xml directly — always override its targets in build.xml.
    • project.properties. Ant properties used by the IDE to configure the Ant script. Although you can edit this file manually, you generally do not need to, as it is automatically updated by the IDE when you configure the project's properties.
    • project.xml and genfiles.properties. IDE-generated metadata files. Although you can edit project.xml manually, for standard projects you generally do not need to. You should never edit genfiles.properties .
    nbproject/private The directory that holds properties that are defined for you only. If you are sharing the project over VCS, any properties you define in private.properties are not checked in with other project metadata and are applied only to your installation of the IDE.
    build The output directory for compiled classes.
    dist The output directory of packaged build outputs (JAR files and WAR files). Standard Java projects produce one build output per project. The dist directory also contains generated Javadoc documentation.

     

  • Free-form templates. Templates in which your own Ant script controls all classpath settings, compilation, running, and debugging. The settings you configure when creating the project are used to tell the IDE how your Ant script manages your source code and must match the settings in your Ant script.

    Free-form projects can contain as many source folders as your Ant script is configured to handle. If your Ant script does not contain targets for all IDE actions, like debugging and running your project, you can easily write Ant targets for these actions.

    Source Folders

    Free-form Java projects can contain multiple source folders. The classpath relationships and handling instructions for your source directories must be handled in your Ant script.

    Project Settings

    In the project's properties, you declare the source folders, classpath, and output files for your project. Each source root can have a unique classpath and output file. These settings do not affect the actual contents or classpath of your application. The settings only tell the IDE how to handle the code. For example, the classpath settings tell the IDE which classes to make available for code completion.

    IDE Commands and Ant Targets

    In free-form projects, the IDE relies on your Ant script to provide targets for all IDE actions, such as running, debugging, and generating Javadoc. If your Ant script does not contain targets for these commands, the commands are disabled.

    You can easily write debug targets in your Ant script or in a supplementary Ant script. You can also add a shortcut to any of your Ant script's targets to the contextual menu of your project's node in the Projects window.

    For a full guide to configuring free-form projects, see:

    http://www.netbeans.org/kb/41/freeform-config.html

     

New Web Application Wizard: Name and Location

The New Web Application wizard creates a new standard project containing an empty web application. You open the New Web Application wizard by opening the New Project wizard and selecting the 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.
  • Source Structure. Specifies how your web application will be structured.

    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

    Jakarta


    • Java BluePrints. The Java BluePrints Project Conventions specify recommended conventions for structuring enterprise applications or web applications.

      About Enterprise Applications

      An enterprise application is a collection of EJB modules and web application modules that are configured to work together when deployed to a J2EE application server. The enterprise application contains information about how the modules work with each other.

      The enterprise application also contains information about how the modules work with the application server to which the enterprise application is deployed. For example, if any entity beans use container-managed persistence, the enterprise application tells the J2EE application server what transaction services are needed.

      An enterprise application has no source files of its own. It only contains deployment descriptors and other configuration files. At compile time, the archive files (JAR files and WAR files) for each of the enterprise application's modules are built and assembled into one Enterprise Archive (EAR) file. This file is deployed to the J2EE application 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.

      About 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:

      • JSP pages and JSP segments.
      • Applets.
      • 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.

      Before you can create a web component, you must create a web application to contain it.

      About 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:

      • 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.

    • Jakarta. The Jakarta recommendations specify recommended conventions for structuring web applications.

    Web Root

    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.

     

  • Add to Enterprise Application. Lets you specify an existing enterprise application to which the web application will be added as a module. If you do not add it here, you can do so later by expanding the enterprise application project node and right-clicking the J2EE Modules node.
  • 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.
  • Context Path. Specifies a way to distinguish resources in one web application from resources in others that are deployed on the same server instance. The context of an application determines the URL namespace of the contents of the web application. When a web application's context property value is set, you access the web application at http://hostname:port/context/servlet_or_jsp. For example, with the property value set to /HelloWeb, you access the web application at http://hostname:port/HelloWeb/index.jsp.
  • 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.

If you click Next, you can let the IDE provide your application with all the source files and libraries needed to work with JSF, Struts, or both frameworks. If you click Finish, the project is created on your computer and opened in the IDE. You can view its logical structure in the Projects window and its file structure in the Files window.

 

New Web Application Wizard: Frameworks

In the Frameworks page, you choose one or more frameworks that you want to use to provide a structure for your web application.

Choose one or both of the following:

  • Struts 1.2.7. Specifies that you want the IDE to provide the Struts 1.2.7 libraries and create the following files for your application:
    • welcomeStruts.jsp
    • struts-config.xml
    • tiles-defs.xml
    • validator-rules.xml
    • ApplicationResource.properties
    For details, see:

    http://struts.apache.org/

  • After you click OK, you can set the following properties:

     

  • Java Server Faces. Specifies that you want the IDE to provide the JSF 1.1 libraries and create the following files for your application:
    • welcomeJSF.jsp
    • faces-config.xml
    For details, see:

    http://java.sun.com/j2ee/javaserverfaces/

    After you click OK, you can set the following properties:

    When you click Finish, the project is created on your computer and opened in the IDE. You can view its logical structure in the Projects window and its file structure in the Files window.

     

Greetings!

Finally got the chance to start my first ever blog! Po-Ting Wu, developer on the Sun Java Studio Creator team since around March 2003. To see the masterpiece we have done, please refer to:

http://developers.sun.com/jscreator/

About

poting

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today