When you create a web page in an EGL web project, EGL creates
a JSF Handler part to go along with the page.
Prerequisites
Additionally, it is best if you choose a target server for
your project before creating web pages. If your project does not have
a target server, support for Faces components will not work at run
time, and you might see a warning reminding you to choose a target
server. See Specifying
target servers for J2EE projects.
Creating a page along with a JSF Handler part
When
you create a web page to be used with EGL, be sure to select the correct
type of web page:
- Click . The New window opens.
- Expand Web and click Web page (not JSP).
- Click Next.
- In the File Name field, type the name for
the new web page. The accompanying JSF Handler will have the same
name with an .egl extension.
- In the Folder field, select the location
for the new web page. The location must be in the WebContent folder
of an EGL web project. The accompanying JSF Handler will be put into
the project's jsfhandlers package unless you
specified a different package in the workbench preferences.
- Optionally, select a template that is compatible with JSP files
in the Template box. If you don't select a
template, the new web page will be an empty JSP file with no template.
- For a blank web page, click .
- For a web page with placeholders for graphics and navigation elements
that are linked to a page template, expand Sample Templates and
select a template.
- To use a template that is already in your project, click My
Templates and choose the template from the Preview box.
If you select a template other than the basic JSP template,
the template files are added to your project, and you can create more
pages from the same template. Then, when you change an area in the
template, the matching area in each web page changes as well. See Page
templates for more information on templates.
If
you have selected a template that is not compatible with JSP files,
a warning will appear at the top of the page. Some templates default
to file types other than JSP, so by typing the .jsp extension
into the File Name field, you constrain yourself
to templates compatible with JSP files.
- Click Finish.
The new web page and its JSF Handler part are created
in your web project. Additionally, EGL creates a navigation rule in
the JSF configuration file that enables you to forward users to this
page.
Creating a page from an existing JSF Handler part
An
alternate way to create an EGL-controlled web page is to create a
JSF Handler part separately, and then let EGL create a default JSP
file for you based on the information in the JSF Handler.
- Click .
- Expand EGL and click JSF Handler.
- Click Next.
- Set the location and file name of the new Handler part.
- Click Finish.
- In the new JSF Handler, create variables to represent the data
that you want to use on the page.
- On each variable that you want to display on the page, set the displayUse property
to input for an input field and output for
a read-only output field. For example, an integer field that you want
to be displayed as an editable input field on the page might look
like this:
myInputVar string {displayUse = input};
For
other options for the displayUse property,
see displayUse.
- Set the view property of the JSF Handler
to the name of the page you want to create, including the .jsp extension.
For example, if your JSF Handler is named myPage,
you might set the Handler's properties as follows:
Handler myPage type JSFHandler
{view = "myPage.jsp"}
...
end
- Save and generate the JSF Handler. EGL generates a default JSP
that is based on the Handler.
You can regenerate the JSP file at any time by deleting the
JSP file and generating the JSF Handler.