DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report

How to Configure Multiple page.xml Files in Seam 2.2

Vineet Manohar user avatar by
Vineet Manohar
·
Apr. 14, 10 · Interview
Like (1)
Save
Tweet
Share
9.63K Views

Join the DZone community and get the full member experience.

Join For Free

Seam lets you specify navigation rules in the pages.xml file which can become very large for apps with many pages and transitions. Seam allows you to break this file into multiple small files. This allows you to easily manage large applications by creating multiple pages.xml files, typically one per page. This article describes how to create multiple pages.xml files in Seam 2.2.

Step 1: Configure /WEB-INF/components.xml

Make sure you declare the navigation namespace at the top of components.xml and each file under <navigation:pages> as follows

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm"
xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail"
xmlns:web="http://jboss.com/products/seam/web" xmlns:navigation="http://jboss.com/products/seam/navigation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
http://jboss.com/products/seam/navigation http://jboss.com/products/seam/navigation-2.2.xsd
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">

<mail:mail-session host="localhost" tls="false" ssl="false" port="25" />

<component>
<property name="createTempFiles">true</property>
<property name="maxRequestSize">1000000000</property>
</component>

<component name="org.jboss.seam.core.init">
<!-- enabling this slows down Seam significantly -->
<property name="debug">false</property>
</component>

<core:init transaction-management-enabled="false" />

<security:identity authenticate-method="#{loginController.authenticate}"
remember-me="true" />

<event type="org.jboss.seam.security.notLoggedIn">
<action execute="#{redirect.captureCurrentView}" />
</event>

<event type="org.jboss.seam.security.postAuthenticate">
<action execute="#{redirect.returnToCapturedView}" />
</event>

<navigation:pages>
<navigation:resources>
<!-- global -->
<value>/WEB-INF/pages.xml</value>

<!-- one per page -->
<value>/WEB-INF/createAccount.page.xml</value>
<value>/WEB-INF/login.page.xml</value>
</navigation:resources>
</navigation:pages>
</components>

Step 2. Save all .page.xml files in WEB-INF directory

WEB-INF/createAccount.page.xml  
WEB-INF/login.page.xml

Step 3. Create the .page.xml files.

See the sample file: createAccount.page.xml below. Note that the root tag is <pages>. Make sure that the same page is not repeated in another file.

<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">

<page view-id="/createAccount.xhtml" login-required="false">
<!-- Create account -->
<navigation
from-action="#{createAccountController.createAccountFormCreateAccount}">

<!-- Account created -->
<rule if-outcome="accountCreated">
<redirect view-id="/login.xhtml">
<message>Your account has been created. Please log in.</message>
</redirect>
</rule>
</navigation>
</page>
</pages>

FAQ

Can I use Seam 2.0 style <view id>.page.xml files?

You should be able to use viewid.page.xml xml files according to the examples that ship with Seam 2.2.0. However, some users have complained that it doesn’t work in Seam 2.1. I could not get it to work with Seam 2.2.0 as well.

From http://www.vineetmanohar.com/2010/04/13/how-to-configure-multiple-page-xml-files-in-seam-2-2

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • OpenVPN With Radius and Multi-Factor Authentication
  • How Elasticsearch Works
  • Journey to Event Driven, Part 1: Why Event-First Programming Changes Everything
  • Create Spider Chart With ReactJS

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: