Home arrow Java arrow Page 4 - Page Navigation using Sun Java Studio Creator 2
JAVA

Page Navigation using Sun Java Studio Creator 2


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.

Author Info:
By: Jayaram Krishnaswamy
Rating: 2 stars2 stars2 stars2 stars2 stars / 3
December 20, 2006
TABLE OF CONTENTS:
  1. · Page Navigation using Sun Java Studio Creator 2
  2. · Navigating to Chicago.jsp by clicking a link on the NewYork.jsp
  3. · Build and run the project
  4. · Navigating between three pages: example 2

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Page Navigation using Sun Java Studio Creator 2 - Navigating between three pages: example 2
(Page 4 of 4 )

The process of navigating between more than two pages follows in exactly the same way as what was described for two pages. The next picture shows the design view of navigation between three pages, HomePage.jsp, Tutorials.jsp, WebSites.jsp. These pages are also in the same project. Each of the pages have two hyperlinks that connect to two other pages as shown.

The <faces-config/> is just one file which includes all the navigation rules for the project. In this case it includes the rules for both the two page example as well as the three page example as shown. The code in blue is for navigating the pages in the three pages HomePage.jsp, Tutorials.jsp and Websites.jsp. The code in green is for the two pages NewYork.jsp and Chicago.jsp. There are no links between the two sets of pages.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config 
PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config> <navigation-rule>
<from-view-id>/HomePage.jsp</from-view-id>
<navigation-case>
<from-outcome>case1</from-outcome>
<to-view-id>/Tutorials.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>case2</from-outcome>
<to-view-id>/Websites.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Tutorials.jsp</from-view-id>
<navigation-case>
<from-outcome>case1</from-outcome>
<to-view-id>/HomePage.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>case2</from-outcome>
<to-view-id>/Websites.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Websites.jsp</from-view-id>
<navigation-case>
<from-outcome>case1</from-outcome>
<to-view-id>/HomePage.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>case2</from-outcome>
<to-view-id>/Tutorials.jsp</to-view-id>
</navigation-case>
</navigation-rule> <navigation-rule>
<from-view-id>/NewYork.jsp</from-view-id>
<navigation-case>
<from-outcome>case1</from-outcome>
<to-view-id>/Chicago.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/Chicago.jsp</from-view-id>
<navigation-case>
<from-outcome>case1</from-outcome>
<to-view-id>/NewYork.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config> 

Instead of beginning with the pages all ready to start with, you may begin adding pages from inside the Page Navigation designer interface by right clicking in an empty area to create a page. Also the designer is quite user friendly. You can highlight a link by clicking it in the designer and looking at its properties as shown. In a simple diagram like this it is obvious, but if there are a large number of links this will be a necessary feature.

Summary

Page navigation is really effortless with Sun Java Studio Creator 2. This article described page navigation for a web project with two examples. The designer is meant for only navigating to Java server pages and is not intended for HTML pages and page fragments. Navigation is truly codeless once it is correctly configured.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
JAVA ARTICLES

- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...
- Generics and Limitations in Java
- Getting Started with Java Web Development in...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials