When you are working with a web page in EGL, you can run
the page on a server to see how it will look when deployed.
This task has the following prerequisites:
- An EGL web project with at least one web page.
- A server defined in the workbench. See Creating
a server.
To run a web page on a server in the workbench:
- Save any unsaved files and generate the project. Note that in
past versions of EGL, JSF Handlers were generated automatically when
you saved the file, but now you can choose whether to generate Handlers
automatically or not. See Setting generation preferences.
- If the server is already running, publish the new versions of
your files to the server by right-clicking the server in the Servers
view and then clicking Publish.
If the server
is not already running, publishing will happen automatically when
you run the page. Depending on the server and its settings, it might
publish automatically when you save changes to the web project; in
this case, wait until the server's status is listed as Synchronized.
- In the Project Explorer view, right-click the JSP file (not the
EGL source file with the JSF Handler) and then click . If you have not yet defined a default server for the
project, the Run On Server window opens.
- In the Run On Server window, select a server to use.
- If you want to use this server each time your run a page, select
the Set server as project default check box.
- Click Finish. The server starts, if necessary,
and the page opens in the internal web browser of the workbench. As
long as the server is running, you can copy the URL from the internal
web browser and paste it into the address field of any external web
browser on your system to view the page in a different browser.
The URL of the web page is set by the JavaServer Faces (JSF), which
controls the run-time display of the JSP files. For example, if you
run a web page named
myPage.jsp in a project named
myProject,
the internal web browser might open to the following URL:
http://hostname:portnumber/myProject/faces/myPage.jsp
You
may also see this URL:
http://hostname:portnumber/myProject/myPage.faces
In
each case,
hostname refers
to the name of your local server, such as
localhost,
and
portnumber refers to
the port of that server. Note that in the first case, JSF adds the
/faces prefix
to the URL. In the other case, it adds the
.faces extension
to the file name, replacing the actual
.jsp extension.
These URLs are equivalent and refer to the same JSP file and JSF Handler
part.
However, conflicts between these two different URLs can cause links
to break when you test web pages in the workbench. If the page opens
as myProject/myPage.faces, relative links to a page
named myProject/myOtherPage.jsp will not work because
JSF sets the location for the target page as myProject/myOtherPage.faces and myProject/faces/myOtherPage.jsp.
In this case, you must either change the link to myProject/faces/myOtherPage.jsp or myProject/myOtherPage.faces,
or open the original page as myProject/faces/myPage.jsp.