Oracle® Enterprise Pack for Eclipse User's Guide
Release 12.1.2.4
E50456-03
  Go To Table Of Contents
Contents

Previous
Previous
 
 

13 Web Application Development Support

Web Application Development Tools is a set of plugins for the Eclipse IDE designed to help develop, deploy, and debug Web applications for Oracle WebLogic Server.

This document contains the following sections:

13.1 Using AppXray Technology

AppXray technology analyzes the JSP pages, Java source files, resource bundles, and Web configuration files of your application and uses this information to provide validation and consistency checking across many layers of the application, as well as source code completion and hyperlink navigation.

You can enable AppXray for your existing Web projects, or use it with your new dynamic Web projects for which it is enabled by default. Once available, AppXray will build its application database that allows it to track artifacts and populate it. If you have created a project using standard Web technologies, or if your project is JSP or JSF-enabled, those artifacts will be detected and added to the database. If you have enabled AppXray on an existing project, then artifacts in that project will be detected and added to the database. AppXray then uses this database for validation. As you work with your application, AppXray will automatically maintain the application database. If this degrades performance, you can selectively disable automatic maintenance and rebuild the application database as required.

Errors detected by AppXray are displayed in the Problems view, whereas dependencies are graphically displayed in AppXaminer.

AppXray collects information about the following:

13.1.1 Enabling and Disabling AppXray

To enable or disable AppXray:

  1. Right-click your project in the Project Explorer and select Properties from the drop-down menu. This opens the Properties dialog.

  2. In the Properties dialog, select the AppXray node. On the editor pane on the right, click Configure workspace settings, and then use the expanded Preferences > AppXray dialog to enable settings specific to your project, as well as fine-tune the technologies that you want AppXray to include in dependency discovery and collection, both of which are AppXray features used for finding missing resources, as well as collecting information about them (collection):

    • The role of discovery is to find variables in JSP pages. For example, disabling JSF discovery will cause managed beans to no longer appear in the Data Palette view.

    • Collection deals with all items that are available in the AppXaminer view (such as broken links, missing resources, JSP variables) and provides the navigation between files (for example, from a JSF commandLink tag to the section of the faces-config.xml file that defines the navigation rule.

    You can disable collection and leave discovery enabled for a particular technology, but not vice versa.


Note:

You cannot modify default project-level settings.


13.1.2 Visualizing AppXray Dependencies

With AppXray, you can expect to have a view of all Web project dependencies. By viewing these interrelationships graphically, missing resources and broken links become immediately apparent and application structure diagrams can be created by drilling down through the layers of your application.

To view dependencies for a Web project:

  1. Right-click your Web project in the Project Explorer and choose Show AppXray Dependencies from the drop-down menu. This opens the AppXaminer view.

    AppXaminer analyzes page, action, class, and many other dependency types. Initially all dependency types are active but can be easily reduced. AppXaminer displays a graph of dependencies between technology-specific artifacts in the project. You can drill down into additional detail on particular references: each dependency link has a number that indicates how many references the focal node contains to the referenced file, with upstream dependency nodes having an indicator on the source end of the link, and downstream nodes having the indicator on the destination end of the link. By clicking the number, you bring up a detail showing the nature of each reference.

    By clicking one of the references you navigate to the corresponding reference location in the referring file.

    You can also right-click on a resource displayed in the AppXaminer diagram and select one of the following options from the drop-down menu:

    • Open - to open the default editor on the file represented by the resource node.

    • Show AppXray Dependencies - to refocus the view on the selected node. Note that this option is disabled for the focal node.

    • Expand All and Collapse All - to expand or collapse nodes. Note that only one or the other is ever enabled, depending on the corresponding state of the node's expand/collapse button. If the node does not have an expand/collapse button, both options are disabled. Since the focal node potentially has two expand/collapse buttons, the options will affect both.

  2. To display the chain of dependencies for the application, in AppXaminer view click the plus signs next to a dependency to drill down into the project and reveal the page structure of the application. Note that the Eclipse Outline view (which you open by selecting Window > Show View > Outline from the top-level menu) is synchronized with AppXaminer. If the AppXaminer diagram becomes too big, you can use the Outline view to scroll around the diagram.

  3. You can filter dependencies by clicking the Filter Dependency button located in the upper right-hand corner of AppXaminer to list the types of dependencies that can be tracked. This opens the Filter Dependency dialog which lets you filter either the project technology-specific artifacts, or artifacts by file extension.

    You can define your custom filter extensions on the Filter Dependency > File Extensions dialog. By filtering out dependencies, you reduce the number of dependencies displayed in the diagram.


    Notes:

    • The artifact types available for display and filtering depend on the technologies used in the project.

    • All artifact types are shown by default.

    • All filter settings persist across invocations, for each technology type.


13.2 Configuring JSF Projects

OEPE provides a JSF project facet with the following functionality that you can use to configure your JSF projects:

To add JSF capabilities to your Web project with Oracle Weblogic Server runtime support:

  1. Right-click your Web project in Project Explorer, select Properties from the drop-down menu, and then select Targeted Runtimes from the list on the Properties dialog. Ensure that you are using Oracle WebLogic Server 11gR1 (10.3.2) or later as your target runtime.

  2. On the Properties dialog, highlight Project Facets node and select JavaServer Faces facet from the list, specifying either version 1.2 or 1.1.

  3. On the same Properties dialog, ensure that WebLogic Web App Extensions facet with one of 1.3.2, 1.3.1 or 1.3 versions is selected, and then click Further configuration available. This opens the Modify Faceted Project > JSF Capabilities dialog.

  4. Complete this dialog by specifying JSF implementation library information, as well as configuration file name and servlet parameters.

    When competing the Modify Faceted Project > JSF Capabilities dialog, you have the following two options with regards to which JSF implementation library to add to your project:

    1. WebLogic Shared Library - this option is available only when your project is configured with WebLogic Web App Extensions facet. If you click Manage WebLogic Shared Libraries, a Preferences > Shared Libraries dialog opens allowing you to modify library information, as well as to remove existing and add new libraries to your project.

    2. User Library - allows you to either download a specific version of the JSF library (you will be prompted to accept an appropriate license), or add the library from a local install (JAR file).

    The system validates the selected library and will notify you if any of the following occurs:

    • The required JSF class cannot be found in the library (for example, if you select a non-JSF user library).

    • The selected library version and the facet version are not compatible (for example, if a JSF 1.1 library is selected for a JSF 1.2 facet).

    • The library version cannot be read.

    You can click Download library to initiate the download of the user library of your choice. Note that if your machine is located inside of a network, which requires a proxy to access outside resource such as the Internet, the download may fail. In this case, reconfigure your Eclipse IDE proxy settings using Window > Preferences > General > Network Connections, and try again.

    If you select Include libraries with this application, the libraries will be copied to your project's WEB-INF/lib directory at publish time.

  5. Click OK on the Modify Faceted Project > JSF Capabilities dialog to save your changes.

Upon completion, the following configurations of your project have taken place:

13.2.1 Supported JSF Libraries and Versions

OEPE provides support for JSF 1.2 and 1.1 versions.

The following table maps the supported JSF versions to three types of libraries:

Table 13-1 Supported JSF Versions

Supported JSF Version Oracle WebLogic Server Shared Library Downloadable Library User Library

JSF 1.2

Supported

Supported: MyFaces, Sun-RI

Supported

JSF 1.1

Supported

Supported: MyFaces, Sun-RI

Supported


13.2.2 Creating a Faces Configuration File

OEPE provides support for Faces configuration resource file by allowing you to create and edit a Faces Configuration File.

To create a new Faces configuration file for your JSF dynamic Web project:

  1. Right-click the Project Explorer and choose New > Other. Alternatively, choose select New > Other from the top-level menu's File or from the AppXplorer view drop-down menu. This opens the New dialog.

  2. On the New JSF Configuration File > JSF Configuration File Properties dialog specify the location for your new file (in the WebContent/WEB-INF folder) and provide a file name.

  3. Click Finish to save your changes.

    A new Faces configuration XML file containing the faces-config declaration is created with the given name and in the specified location.

    The project's web.xml file is updated with a new path string in the value of the javax.faces.CONFIG_FILES context parameter. If the javax.faces.CONFIG_FILES context parameter does not exist, it is created.

Alternatively, in the Project Explorer you may right-click your JSF project's Faces Configuration directory and choose New JSF Configuration File from the drop-down menu.

13.2.3 Using the Faces Configuration Node

Using your JSF dynamic Web project's Faces Configuration node, you can create the following:

  • Managed beans

  • Navigation rules

  • Converters

  • Validators

13.2.3.1 Creating a New Managed Bean

You can create s managed bean in your Web application to bind the bean properties and business logic to the user interface components.

To create a managed bean:

  1. In the Project Explorer, expand your JSF dynamic Web project's Faces Configuration node, right-click Managed Beans, and then select New Managed Bean. This opens the New Managed Bean Wizard dialog which allows you to create a managed bean from an existing or a newly created Java class.

  2. If you choose to create a managed bean from an existing class:

    1. On the New Managed Bean Wizard > Java Class Selection dialog click Browse to open the Select Type dialog. In this dialog, start typing the bean class name in the Select entries field, then select the class from the list and click OK.

    2. Proceed by clicking Next on the New Managed Bean Wizard > Java Class Selection dialog to open the New Managed Bean Wizard > Managed Bean Configuration dialog.

    3. Click Next to review the summary page, and then click Finish. Notice that your new bean has been added under the Faces Configuration > Managed Beans node.

  3. If you choose to create a new Java class for your managed bean:

    1. On the New Managed Bean Wizard > Java Class Selection dialog select Create a new Java class, and then click Next to open the New Managed Bean Wizard > Java Class dialog.

    2. Complete this dialog, and then click Next to open the New Managed Bean Wizard > Managed Bean Configuration dialog. On this dialog, click Next to proceed to the summary page, and then click Finish. Notice that your new bean has been added under the Faces Configuration > Managed Beans node

13.2.3.2 Creating a New Navigation Case

You create navigation rules to link Web pages. Each navigation rule can contain one or more navigation cases.

To define navigation rules and cases:

  1. In Project Explorer, expand your JSF dynamic Web project's Faces Configuration node, right-click Navigation Rules, and then select New Navigation Rule. This opens the New Navigation Rule dialog which allows you to create a new navigation rule by providing an either new or existing JSP source page, and then defining destination pages.

  2. If you choose to create your navigation rule using an existing JSP page as a source page:

    1. On the New Navigation Rule dialog click Browse for JSP to open the Select JSP File dialog and select the page.

    2. Define one or more navigation cases from the source page by clicking New on the New Navigation Rule dialog to open the New Navigation Case dialog.

      Note that the destination page for your new navigation case can be an existing JSP page that you select using the Select JSP File dialog, or a new JSP page.

    3. If you need to, create a new JSP. Click Create a New JavaServer Page on the New Navigation Case dialog to open the New JavaServer Page > JavaServer Page dialog. Using this dialog, select a package and provide a name for your new JSP page, and then click Next.

    4. On the next New JavaServer Page > Select JSP Template dialog select a template to serve as initial content of your new JSP page, and then click Finish.

      Click OK on the New Navigation Case dialog.

  3. If you choose to create your navigation rule using a newly create JSP page as a source page, click Create a New JavaServer Page on the New Navigation Rule dialog to open the New JavaServer Page > JavaServer Page dialog.

    Notice that your new navigation rule has been added under the Faces Configuration > Navigation Rules node.

13.2.3.3 Creating a New Converter

You can create a converter for your Web application. A converter is used in the conversion model, where each component can be associated with the server-side model object data. The component data can have two views: model and presentation. You can enable conversion of the data between the model view and the presentation view.

To create a converter:

  • In the Project Explorer, expand your JSF dynamic Web project's Faces Configuration node, right-click Converters, and then select New Converter. This opens the New Converter dialog where you can define a new converter.


Notes:

  • The implementation class of your converter must be an extension of the javax.faces.convert.Converter.

  • The implementation class of your converter must be an extension of the javax.faces.convert.Converter.


13.2.3.4 Creating a New Validator

To create a validator for your JSF project:

  1. In the Project Explorer, expand your JSF dynamic Web project's Faces Configuration node.

  2. Right-click Validators, and then select New Validator. This opens the New Validator dialog where you define the new validator.


Note:

The implementation class of your validator must be an extension of the javax.faces.validator.Validator.


13.2.4 Using the Faces Configuration Editor

The Faces configuration editor allows you to modify the faces-config.xml file to define and edit page navigations, managed beans, components, converters, validators, render-kit, as well as to perform other element configurations.

You use the editor as follows:

In the Project Explorer, right-click your JSF dynamic Web project's Faces Configuration node, and select Open. This opens the Faces Configuration Editor' start page. This page enables access to useful resources such as documentation and help topics.

Use the following tabs to edit the Faces configuration:

  • Overview tab that Figure 26 shows offers the compact presentation of all editable information. Double-clicking an element opens a relevant editor tab to enable editing.

  • Overview tab that Figure 26 shows offers the compact presentation of all editable information. Double-clicking an element opens a relevant editor tab to enable editing.

    You can create navigation rules by dragging and dropping JSP pages onto the canvas in one of the following ways:

    • Directly from the Project Explorer.

    • From the Palette by selecting Nodes > Page to open the Select JSP File dialog that Figure 28 shows.

    To draw links between pages, use the Palette's Link tool.

    You can reposition elements on the canvas. In addition, you can modify the elements' properties using the Quick Edit editor that displays properties of the selected element.

  • Managed Bean tab allows you to modify configuration of managed beans in your project.

  • Component tab enables editing of information about components, converters, validators, and render kits that you defined for your project.

  • Others tab lets you edit various Faces configurations that are not covered in any of the other tabs.

  • Source tabs provides access to the faces-config.xml file itself.

13.2.5 Understanding JSF Resource Bundles

If you would like your JSF application to use a resource bundle, you need to register it with the application. For JSF projects, when they are configured with the JSF facet, an application.properties file is automatically created in the src/resources folder. As one of the uses of a resource bundle is to enable localization, a loadBundle tag is typically added to each JSP page you want to localize:

<f:loadBundle basename="resources.application" var="bundle"/>

13.3 Configuring JSTL Projects

OEPE provides a JSTL project facet. You can add JSTL support to a new or existing Web project with Oracle Weblogic Server runtime support.

To add JSTL support:

  1. Right-click your Web project in Project Explorer, select Properties from the drop-down menu, and then select Targeted Runtimes from the list on the Properties dialog. Ensure that you are using Oracle WebLogic Server 11gR1 (10.3.2) or later as your target runtime.

  2. On the Properties dialog, highlight Project Facets node and select JSTL facet from the list, specifying either version 1.2 or 1.1.

  3. On the same Properties dialog, ensure that WebLogic Web App Extensions facet with one of 1.3.2, 1.3.1 or 1.3 versions is selected, and then click Further configuration available. This opens the Modify Faceted Project > JSTL Library dialog.

  4. Complete this dialog by specifying JSTL library information.

    When completing the Modify Faceted Project > JSTL Library dialog, you have the following two options with regards to what type of JSTL library to add to your project:

    • WebLogic Shared Library - this option is available only when your project is configured with WebLogic Web App Extensions facet. If you click Manage WebLogic Shared Libraries, a Preferences > Shared Libraries dialog opens allowing you to modify library information, as well as remove existing and add new libraries to your project.

    • User Library - allows you to either download a specific version of the JSTL library (you will be prompted to accept an appropriate license), or add the library from a local install (JAR file).

    The system validates the selected library and will notify you if any of the following occurs:

    • The required JSTL class cannot be found in the library (for example, if you select a non-JSTL user library).

    • The selected library version and the facet version are not compatible (for example, if a JSTL 1.1 library is selected for a JSTL 1.2 facet).

    • The library version cannot be read.

    You can click Download library to initiate the download of the user library of your choice. Note that if your machine is located inside of a network, which requires a proxy to access outside resource such as the Internet, the download may fail. In this case, reconfigure your Eclipse IDE proxy settings using Window > Preferences > General > Network Connections, and try again.

  5. Click OK on the Modify Faceted Project > JSTL Library dialog to save your changes.

Upon completion, your project's web.xml will be configured.

13.3.1 Supported JSTL Libraries and Versions

OEPE provides support for JSTL 1.2 and 1.1 versions.

The following table maps the supported JSTL versions to three types of libraries:

Table 13-2 Supported JSTL Versions

Supported JSTL Version Oracle WebLogic Server Shared Library Downloadable Library User Library

JSTL 1.2

Supported

Supported

Supported

JSTL 1.1

Supported

Supported

Supported


13.4 Configuring Projects for Apache Trinidad

OEPE provides an Apache Trinidad project facet with the following functionality that you can use to configure your JSF projects:

To configure your Web project for Apache Trinidad:

  1. Either add the Trinidad facet when you create the project, or add the facet to an existing project by right-clicking your project in the Project Explorer and selecting Properties from the drop-down menu. This will open the Properties dialog, as Figure 1 shows.

  2. On the Properties dialog, select Project Facets on the left panel, and then select Trinidad from the Project Facets list. Note that the Trinidad 1.2 facet requires JavaServer Faces version 1.2.

    To configure your project to use Trinidad 1.2 library, select the Trinidad 1.2 facet, and then click Further configuration required. This will open the Modify Faceted Project > Trinidad Library dialog, as Figure 2 shows. If Trinidad 1.2 is not listed, then click Download Library icon to indicate your intention to obtain the library. This will open the Download Library dialog, as Figure 3 shows.

  3. Select Trinidad 1.2 library and the destination folder, and then click Next. Note that if you select a library other than Trinidad, or a mismatch between a Trinidad facet version and library version is detected, a notification message will be displayed alerting you of the error.

  4. On the next screen, accept the term of the Apache license, and click Finish to trigger the download. Figure 4 shows Modify Faceted Project > Trinidad Library dialog after the Trinidad library has been downloaded.

Upon completion, the following configurations of your project have taken place:

13.4.1 Trinidad Library Support by the Trinidad Facet

OEPE provides support for Trinidad 1.2 and 1.0 versions.

The following table associates the supported Trinidad versions with JSF versions:

Table 13-3 Supported Trinidad Versions

Supported Trinidad Version Associated JSF Version

1.2

1.2

1.0

1.1


13.5 Configuring Projects with External Resources

If you have a project that uses external resources, for example Java classes and web resources such as JSP files, which are present outside of your workspace, or from other projects, you can configure the project so that WebLogic looks up these resources at runtime.

The features that you can use are:

13.5.1 Using a Dynamic Project

If your project is not an Eclipse WTP project you need wrap it with a dynamic web project in order to deploy it to Oracle WebLogic Server. Once you have created the skeleton web project, you can use the linked resources technique (below) to link web resources to the corresponding Web content or Java source folder in the dynamic Web project. This project may contain a number of optional facets, one of which is the Web Service facet. Each dynamic Web project ultimately produces a J2EE module, and each J2EE module is included in the complete application's EAR file when the application is built for deployment. The contents of Web projects are accessed through URLs.

For more information, see "Creating a dynamic Web project" which is available in the Web Tools Platform User Guide in the Eclipse documentation.

13.5.2 Using Linked Resources

Linked resources are files and folders stored in a different location but which can be linked to your project. You can link both Web content such as JSP files and HTML files, folders or Java source folders into a web project using this method. For more information, see Linked resources which is available in the Workbench User Guide in the Eclipse documentation. For information about using linked resources, see Creating linked resources, in the Workbench User Guide in the Eclipse documentation.

13.5.3 Configuring a Deployment Assembly

The types of external resource you can configure using deployment assembly are:

  • Archives available via a path variable, or on the local file system, or in the current workspace.

  • Folders in the current workspace.

  • Java build path entries.

  • Projects in the current workspace.

To configure a project to use external resources:

  1. Right-click your Web project in Project Explorer, select Properties from the drop-down menu, and then select Deployment Assembly from the list on the Properties dialog.

    Figure 1 shows a web content folder from linked resources and an external JAR have been added to the deployment assembly.

  2. Click Add to open the New Assembly Directive dialog, where you specify the external resources to be configured with your project.

  3. Choose the type of external resource you want to add on this page and click Next.

  4. On the next page, navigate to the specific external resource you want and click Finish.

13.6 Creating a JSF Project From an Existing Web Project

Using OEPE, you can create a new JSF project from an existing Web project if the existing project meets the following criteria:

To create your project:

  1. Right-click the Project Explorer and select New > Project from the drop-down menu. This opens the New Project dialog.

  2. Select Web > Dynamic Web Project from Existing Source from the list, as Figure 1 shows, and then click Next. This opens the New Web Project dialog.

  3. On the New Web Project > Project Location dialog that Figure 2 shows, specify your existing project's location, provide a name for your new project, select the compiler compliance level, select Oracle WebLogic Server 11gR1 (10.3.2) or later as your target runtime, and then click Next to continue.

  4. On the next New Web Project > Java Settings screen that Figure 3 shows, either accept the default Java settings for your project or customize them, and then click Finish.

Upon completion, the new project from the existing source is created and is configured with the following facets:

13.7 Using the Web Page Editor

You use the Web Page Editor to edit JSP and HTML files. It is a multi-page editor that provides the following:

Using its toolbar, you can configure the editor to display both a Design and a Source page of the current document in either horizontal or vertical split modes, as Figure 1 shows. You can also configure it to display only either the Design or the Source page. Note that the currently-selected element is synchronized between all pages and views.

The following views are associated with the Web Page Editor:

The Web Page Editor also includes the Preview tab and a toolbar. The toolbar enables the following:

To access the Editor, from your Web project open in the Project Explorer, right-click a page which you are planning to edit, and then select Open With > Web Page Editor from the drop-down menu, as Figure 2 shows.

13.7.1 Using the Design View

The Design view is editable and allows you to select elements and move them around on the page, display an element's properties in the properties editor, drop tags from the Palette onto the page, edit elements using the context menu, and so on.

Figure 3 shows a JSP page displayed in the design view with an input text selected and its properties displayed in the properties editor.

Note that some elements enable tag-specific editing through the context menu.

The Design view provides tooltips with the information on which element will be selected upon a mouse click.

In addition, the Design view allows you to visually inspect and select nonvisual child components, such as converters and validators. To do so, float the cursor over an element, and you will see these nonvisual child components as semitransparent icons at the top-right of the element.

Selecting the element and then clicking the "pin" icon that appears at the top-right of the element will then let you select the nonvisual child component by clicking the component's icon.

13.7.2 Using the Preview Tab

he Preview tab represents a non-editable view that closely emulates the Web page as it will be rendered at run time.

Figure 6 shows a preview of a JSP page.

13.7.3 Using the Source View

The Source view is editable and allows you to select elements, display an element's properties in the properties editor, drop tags from the Palette onto the page, and so on. Figure 7 shows a JSP page displayed in the Source view with an output text selected and its properties displayed in the properties editor.

13.7.3.1 Using the Content Assist

You can use the content assist feature of the Source view that lets you select tags from a list of available tags with descriptions. You activate the content assist by pressing Ctrl+Space key combination.

13.7.3.2 Using HyperLink

You can use the HyperLink feature of the Source view to open a managed bean's code. To do so, press Ctrl+Click key combination on the value attribute of a tag.

13.7.3.3 Using HoverHelp

The Source view offers the HoverHelp that displays information about the page elements, or on how to use them.

You can zoom in to the help topic by pressing F2.

13.7.4 Using the Outline View

The Outline view (see Figure 6) allows you to do the following:

  • Visually inspect the document structure

  • Change the selection of the current element

  • Drag and drop elements within the view

  • Modify elements and attributes using the context menu

13.8 Editing Tags Using Property Sheets

You use property sheets to quickly edit the most common attributes of various tags with assistance of choice dialogs. Property sheets offer collapsible sections and provide buttons that enable choice of values and binding to dynamic values.

The Property sheet (view) displays attributes and their values for a tag selected in the Design or Source page. The Property view consists of two tabs:

You open a Property sheet (see Figure 1) by selecting Window > Show View > Properties from the top-level menu. By selecting a tag in the Source or Design view and then clicking on buttons located to the right of attribute edit fields on the Property sheet displays editor dialogs.

13.8.1 Choosing Binding

You use the Choose Binding dialog to create bindings to dynamic values. Figure 2 and Figure 3 show the Variables and Resources tabs of this dialog.

The Resources tab allows you to do the following:

  • Select the resource bundle, if more than one exists.

  • Select the resource key.

  • Select whether the dialog should display the resource key or value. You use the View combo box to make this choice.

  • Add a resource key by clicking the New Resource Key.

13.8.2 Choosing a Method

You use the Choose Method dialog that Figure 4 shows to select an existing or create a new method in the selected managed bean.

To create a new method, click New Validator Method, and then complete the New Method dialog.

13.8.3 Selecting a Navigation Case

You use the Select Navigation Case dialog that Figure 6 shows to specify a navigation case outcome. If there are no existing navigation cases listed, you may click New Navigation Case to open a dialog that will let you define a new navigation case (action) and either select an existing JSP page in the project, or create a new destination JSP page for your new navigation case.

13.8.4 Selecting a File

You use the File Selection dialog to select the source of a file, such as an image, CSS, or a JSP file. To open the dialog, click Select File.

13.8.5 Selecting a Style Class

You use the Choose Style Class dialog to select a style class for the selected tag.

13.8.6 Defining CSS Style

You use the CSS Style Definition dialog to define a CSS to apply to the tag. Using this dialog, you can define all elements of a style sheet.

Note that for the style to be applied, you need to register it with the application.

13.8.7 Choosing a Resource Bundle

You use the Resource Bundle Selection dialog to choose a resource bundle for your application (as defined by the basename attribute). The dialog displays a list of available resource bundles including the following:

  • Resource bundles that reside in your project's src directory.

  • Resource bundles in JAR files in your project's WEB-INF/lib directory.

  • Resources bundles in JAR files in Shared Libraries.

  • Resources bundles in JAR files in User Libraries.

Note that this dialog allows you to set the resource bundle defined by the basename attribute of the JSF Core loadBundle and JSTL Formatting setBundle tags.

Also note that if the basename attribute contains a valid value, it will be selected in the dialog by default.

13.8.8 Choosing a Validator

You use the Validator Id Selection dialog to choose a validator from a list of available validators, which includes the standard JSF validators and any validators that are defined in the faces-config.xml file. Note that through this dialog you set the value of the validatorId attribute of the JSF Core validator tag.

If the validatorId attribute already contains a valid value, this value is displayed separately at the top of the dialog.

13.8.9 Choosing a Converter

You use the Converter Id Selection dialog to choose a converter from a list of available converters, which includes the standard JSF converters and any converters that are defined in the faces-config.xml file. Note that through this dialog you set the value of the following attributes:

  • converterId attribute of the JSF Core converter tag.

  • converter attribute of JSF HTML inputText and outputText tags.

If the converterId or converterId attribute already contains a valid value, this value is displayed separately at the top of the dialog.

13.9 Using the Web Page Editor Palette

You use the Web Page Editor Palette to edit and create a variety of tags, such as HTML, JSP, JSF, and so on.

In addition to standard HTML and JSP tags, the Palette displays an item for each tag in the JSP tag libraries that are on the application's classpath. You drag and drop tags on to the Design or Source view to design Web pages. You can pin the Palette to be open, or set to automatically expand when the cursor is placed over it while it is in its collapsed state.

To access the Palette, from your Web project open in the Project Explorer, right-click a page on which you are planning to drop or edit tags, and then select Open With > Web Page Editor from the drop-down menu.

With the page open in the editor view, click Show Palette (a gray triangular button located at the top right corner of the editor) to display the Palette.

13.9.1 Displaying the Palette in External View

You can display the Palette outside of the Web Page Editor. To do so, right-click the Palette and select Options > Show as External Palette from the drop-down menu

To reverse the external view display and have the Palette displayed as a part of the Web Page Editor, click the Close button.

Notice that the external view allows you to filter the tag library nodes to define which ones the Palette should display. To do so, enter the filter text in the filter field.

13.9.2 Editing Tag Library Entries in the Palette

To add a tag, you select it from the library and then drag it from the Palette and drop onto the JSP page that is open in either the Design or Source view in the Web Page Editor. You can enter values for the tag attributes using the corresponding dialog that pops up upon the drop.

Alternatively, you can use a property sheet to add and edit tags.

13.9.3 Using the Data Palette

The Data Palette is a part of the Web Page Editor Palette and is always the last list item in the tag library list.

The Data Palette displays variables in scope for the page, as follows:

  • Variables are displayed as children of a group and grouped by Page Variables and External Variables. If a group does not contain any member variables, the group is not displayed. The scope of a variable is indicated by an icon (green square for the application scope, blue triangle for the session scope, orange rectangle for the request scope, and blue circle for the page scope), as well as by the tool tip text that also provides information about the variable type, name, and data type.

  • Fields are displayed as children of a variable and include fields with accessor methods indicated by a green circle and a tool tip text that lists the field name and data type.

  • Fields of fields are displayed as children of the fields.


Note:

The Data Palette automatically refreshes itself when variables are discovered. Also note that when the Palette is displayed as an external view and you have the ability to use filters, you can filter by "used variable only".


The Data Palette allows you to do the following:

  • Add a variable to a page by right-clicking a variable and selecting Insert in the page from the drop-down menu.

    This opens the Insert Fields dialog that lets you select a generator for content creation choose fields that you would like to generate and define the order in which they should appear.

  • Navigate to a variable declaration by right-clicking the variable and selecting Open Declaration from the drop-down menu.

    This opens the editor with the position of the variable declaration highlighted.

  • Navigate to the value reference type declaration by right-clicking the variable and selecting Open Type from the drop-down menu.

    This opens the appropriate Java class in the source editor or, if the source is not available, in the read-only Class File Editor.


    Notes:

    • If the type is an array type, the component type is used. For example, if it is java.lang.String[], you would navigate to java.lang.String.

    • If the type is a collection type, the container type is used.

    • The navigation is not available for primitive types.


  • Create new external (artificial) variables by right-clicking a variable group node and selecting New Artificial Variable from the drop-down menu. This opens the New Artificial Variable dialog. You create a variable by entering its name and providing its data type.

13.9.4 Customizing the Palette

To customize the way the Palette displays tags, right-click a specific tag library node and select Options > Customize.

This opens the Customize Palette dialog.

Using this dialog, you can modify names and descriptions of tag library nodes, specify whether or not a particular node should be displayed, as well as import or export tag libraries.

You can also modify the Palette settings by right-clicking a specific tag library node and selecting Options > Settings to open the Palette Settings dialog.

Using this dialog, you can specify the font, layout, and icon size for a tag library node, as well as define drawer options.

13.9.5 Docking and Undocking the Palette

When the Palette is displayed as an external view, you may choose to change the display to the docked view in the Web Page Editor. To do so, click on the Palette tab and select Fast View from the drop-down menu.

Notice the Palette icon at the bottom left corner of the main IDE window.

13.9.6 Modifying the Display of the Palette

In addition to performing the Palette customization using the Customize Palette and Palette Settings dialogs, you can modify the way the Palette and its tag library nodes are displayed within the Web Page Editor as follows:

  • Move it to the left or right side of the Web Page Editor by clicking the top area and dragging the cursor to the left or right.

    Alternatively, you can move the Palette by right-clicking the top area and selecting Dock On > Left or Dock On > Right from the drop-down menu.

  • Change the width of the Palette by right-clicking the top area and selecting Resize from the drop-down menu.

  • Use the marquee tool. To do so, click the Marquee button located on the Palette toolbar.

  • Apply the following changes to a tag library node by making selections from the drop-down menu with the cursor positioned on a particular node:

    • Expand the size of a tag library node to the size of the Palette by selecting Maximize.

    • Remove a tag library node from the Palette view by selecting Hide.

    • Undo the preceding changes by selecting Restore.

  • Change the Palette layout or the size of icons for a tag library node by selecting appropriate options from the drop-down menu.

13.10 Enabling Localization in the Web Page Editor

To localize your Web application:

  1. Register the application's resource bundle. For localization to take effect, you define multiple properties files (one for each language), such as application_fr.properties or application_it.properties, for example, in your project's srs/resources directory.

  2. Localize the JSP page by binding the attributes of tags that display text on the page, as follows:

    • Select a tag in the JSP file and open a property sheet to display the tag's attributes in editable mode.

    • Click Bind to a dynamic value button located to the right of the field that you are editing to open the Choose Binding dialog, and then open the Resources tab.

      The Resources tab displays either the available resource keys or their corresponding values (you set the display mode by making selection in the View box).

    • Using this dialog, you can create a new resource key in the bundle by clicking New Resource Key button a dialog that allows you to define a key and value combination to be added to the resource bundle.

      For example, if the entered key is welcome.back with the value "Please, come back", the newly created resource would be displayed in the Choose Binding dialog,.

  3. You can visualize the resources in different locales in the Web Page Editor. To set the design-time locale for your project, use the Resource Locale dialog that you open by selecting a text in the Web Page Editor, and then selecting Text > Resource Locale from the top-level menu.

    Once you choose a new locale and define a new resource key, the new key will be saved in the locale-specific properties file.

13.11 Creating JSF HTML Tags

OEPE provides tag drop support for JSF Web projects. This OEPE feature is made available through a series of wizard-style dialogs that are displayed during "specialty" drops that require not just simple tag editors, but tag-addition guides that assist you by offering appropriate attribute editors and default values. Note that you cannot use these editors to modify tags, but only to add panelGrid, dataTable, and form tags.

To access this OEPE functionality, open your JSF Web project in Project Explorer, right-click a JSP page on which you are planning to drop tags, and select Open With > Web Page Editor from the drop-down menu.

With the page open in the editor view, click Show Palette (a gray triangular button located at the top right corner of the editor) to display the Palette.

To add tags, you drag one of Panel Grid, Data Table, or Form components from the Palette to the body of your JSP page in the editor and complete New dialogs.

Note that you have an option of binding dialogs' fields to beans or bean properties by clicking buttons located to the right of most fields.

13.11.1 Adding a PanelGrid Tag

You add a panelgrid tag using the New Panel Grid dialog that provides tag attribute editors.

Using this dialog, in the Generation options field, specify whether you are adding a new panelGrid tag, or generating one and its content from data. If you choose the former, proceed with the following:

  • In the Columns field, enter a number of columns.

  • In the Width field, specify the width as an integer.

  • In the Table Class field, specify the table style class.

If you choose the latter, the New Panel Grid dialog will change and you proceed as follows:

  1. Specify the bean property by clicking Select a Variable button located to the right of the Bean property field to open the Choose Bean/Bean Property dialog.

  2. Click OK on the Choose Bean/Bean Property dialog, and then click Next on the New Panel Grid dialog to open the New Panel Grid > Choose Fields dialog.

  3. On the New Panel Grid > Choose Fields dialog, you may select the fields that you want to generate for your panel grid, and then click Next.

  4. On the next New Panel Grid > Choose Field Components, Labels and Ordering dialog, you may select components to represent fields and the labels for these fields. In addition, you may define the order in which the fields will appear by clicking Up and Down buttons located to the right of the Field Selection area.

  5. You may click Next to open the New Panel Grid > Choose Options dialog. On this dialog, define if your panel grid should have a header and a footer, and whether or not validation messages should be displayed for input fields, and if so, choose their style by clicking a button to the right of Style class field to open the Choose CSS Style Class dialog.

  6. Upon completion, in the body element of your JSP page an empty h:panelGrid tag with the specified parameters is added.

13.11.2 Adding a dataTable Tag

You add a dataTable tag using the New Data Table dialog.

Using this dialog, in the Generation options field specify whether you are adding a new dataTable tag, or generating one and its content from data. If you choose the former, proceed with the following:

  • In the Data Table area, provide the table ID, as well as to which UI component this table is to be bound by clicking the Bind to a dynamic value button located to the right of the Binding field and making selection of either variables or resources on the Choose Binding dialog.

  • In the Data Table area, provide the table ID, as well as to which UI component this table is to be bound by clicking the Bind to a dynamic value button located to the right of the Binding field and making selection of either variables or resources on the Choose Binding dialog.

  • In the Table Properties area, you may set the table's width and border size as integers, as well as specify classes for the table, row and column.

If you are generating a dataTable and its content from data, the New Data Table dialog will change and you proceed as follows:

  • Specify the enumerable bean property by clicking Select an Enumeration button located to the right of the Enumerable field to open the Choose Enumerable Bean Property dialog.

  • Enter the iteration variable name and type by completing appropriate dialogs. You may also choose the enumerable fields to generate and define their order, as well as insert a header and footer for your table. For information on how to do this, see Section 13.11.1, "Adding a PanelGrid Tag."

Upon completion, a h:dataTable tag with the specified parameters is added within the body element of your JSP page.

13.11.3 Adding a form Tag

You add a form tag using the New Form dialog.

Using this dialog, in the Generation options field specify whether you are adding a new form tag, or generating one and its content from data. If you choose the former, proceed with the following:

  • In the Id field, enter the form ID.

  • In the Binding field, specify to which UI component this form is to be bound by either entering the value, or clicking the Bind to a dynamic value button located to the right of the Binding field and making selection of either variables (of type javax.faces.component.UIComponent) or resources on the Choose Binding dialog.

If you choose to generate a dataTable and its content from data, the New Form dialog will change, and you proceed as follows:

  • Specify an existing JSF managed bean by clicking the Select a Variable button located to the right of the Form bean field to open the Choose Bean/Bean Property dialog.

    Click OK on the Choose Bean/Bean Property dialog.

  • Optionally, you can specify a form action, such as a navigation case outcome or a method binding, by clicking button to the right of the Form action field. Clicking Select a value will open the Select Navigation Case dialog. If there are no existing navigation cases listed, you may click New Navigation Case to open the dialog that will let you to define a new action (navigation case).

To specify a method binding, click Bind to a dynamic value button located to the right of the Form action to open the Choose Method dialog that will let you select a method, if available, or add a new method in the selected bean.

You can either click Finish on the New Form dialog, or click Next sequentially to provide the following optional configurations:

  • Fields - from the list of fields with accessor methods, select fields to generate.


    Notes:

    • Fields of fields are displayed recursively as children.

    • Non-complex" first-level fields are selected by default; other fields, such as enumerated types and dates, are not selected because they are considered "complex".


  • Field Components, Labels and Ordering - select components to represent fields and the labels for these fields. In addition, you may define the order in which the fields will appear by clicking Up and Down buttons located to the right of the Field Selection area.

  • Options - define if your form should have a header and a footer, and whether or not validation messages should be displayed for input fields, and if so, choose their style by clicking a button to the right of Style class field to open the Choose CSS Style Class dialog.

13.12 Generating Struts Artifacts

You can use OEPE to automatically generate various Struts artifacts for your dynamic Web project. To do so, perform the following steps:

13.12.1 Configuring a Project for Struts

To configure your dynamic Web project for Struts:

  1. Either add the Struts facet when you create the project, or add the facet to an existing project by right-clicking your project in the Project Explorer and selecting Properties from the drop-down menu. This will open the Properties dialog.

  2. In the Properties dialog, select Project Facets on the left panel, and then select Struts from the Project Facet list. Note that the Struts facet requires dynamic Web module version 2.3 or later.

    To configure your project to use Struts 1.3 library, select the Struts 1.3 facet, and then click Further configuration required... link. This will open the Modify Faceted Project > Struts dialog. If Struts 1.3 is not listed, then click Download Library icon to indicate your intention to obtain the library. This will open the Download Library dialog.

    Note that you can either add the library from the local installation, or you can select a shared library provided by Oracle WebLogic Server (if this option is supported).

    Select Struts 1.3 library and the destination folder, and then click Next. Note that if you select a library other than Struts, or a mismatch between a Struts facet version and library version is detected, a notification message will be displayed alerting you of the error.

    On the next screen, accept the term of the Apache license, and click Finish to trigger the download.

  3. Click OK on the Modify Faceted Project > Struts Facet dialog.

  4. To complete the configuration of the Struts library for your project, click Apply > OK on the Properties dialog.

13.12.2 Generating Struts Files and Updating the Configuration

When added to your dynamic Web project, the Struts facet automatically generates the following artifacts and preforms the following configurations:

Configures the web.xml file, as follows:

  • Adds an action servlet in a form of the org.apache.struts.action.ActionServlet.

  • Adds a servlet-mapping (using the URL *.do pattern).

  • Adds a config parameter for struts-config.xml.

  • Adds Struts-specific configuration files, such as struts-config.xml and others, in your project's WEB-INF/config directory.

  • Adds JSP template files and resource bundles containing the sample Struts code that you can deploy out of the box.

13.13 Supported Versions

OEPE provides support for various Oracle WebLogic Server versions, as well as the following Apache Struts versions:

The following table maps supported versions of Struts libraries and Oracle WebLogic Server shared libraries:

Table 13-4 Supported Versions of Struts Libraries

Struts Library Oracle WebLogic Server Shared Library Downloadable Library User Library

Struts 1.3

Not supported

Supported

Supported

Struts 1.2

Oracle WebLogic Server versions 10.0 and 9.2 are supported

Supported

Supported

Struts 1.1

Oracle WebLogic Server versions 10.0 and 9.2 are supported

Supported

Supported