Site navigation should not be an afterthought, but it can be difficult and tedious to set up correctly. Sun Java Studio Creator 2 helps take the pain out of this important part of site building. Keep reading to learn how.
Page Navigation using Sun Java Studio Creator 2 (Page 1 of 4 )
Page navigation is an important aspect of web development which cannot be overemphasized. It can make or break a web site. Once the navigation structure is defined, a scheme for going from one page to another is required. This is achieved by implementing a linking mechanism. Depending on the size of the site, the links have to be carefully set up and optimized to reach any part of the site with the smallest number of clicks possible while providing a clear route back to the home page. This is especially important for the common visitor who surfs to your side guided by a search engine which casts him on any page that was searched. Links between the pages are therefore of greatest importance.
Sun Java Studio Creator 2 makes it extremely easy to build the navigation by creating a design interface that creates the navigation model, an XML-based resource configuration file. This tutorial takes you through the steps involved in creating a navigation scheme that will link three Java server pages using the Page Navigation UI, an integral part of a Sun Java Studio Creator web project.
Mechanics of creating a navigation scheme: example 1
This example with only two pages illustrates very clearly how the scheme works. You will appreciate the fact that no code is needed for the success of this scheme. We create a Java Server faces web application project from File -->New Project and choose the Web option in the categories pane and the JSF Web Application in the projects pane. Here a project named Navigation was created. This adds the folder with several other folders and files to the project as shown in the next picture.
In this folder you can easily identify the Page Navigation icon which leads to the UI that actually contains the defining rule for the way in which navigation has to take place between the pages in this project. The defining rule is in the XML format, but Creator 2 provides a visual designer to carry out the navigation set up.
Add two Java server pages to the project by right clicking the Web Pages node and clicking on the page drop-down menu item as shown.
In this way two pages, NewYork.jsp and Chicago.jsp, were added to the project. After adding the pages to the project, click on the Page Navigation icon in the Navigation project. This opens the Page Navigation window as shown. When you add JSP they get added to this window as well. You can move these page objects in the designer by holding down the shift key and dragging the page by the mouse (by default they line up side by side horizontally). If there are any controls that can evoke events for navigation, such as a hyperlink or a button, they should be visible on the pages in this view. Currently the pages are empty.